diff options
author | 2014-10-29 11:27:40 +0900 | |
---|---|---|
committer | 2014-10-29 11:52:08 +0900 | |
commit | 80980574acfef74f9392da4fdbcba64d911cb66f (patch) | |
tree | 23681131f4b7450837ebaba98c09f48e4d572bc0 /tests/src | |
parent | 48ee473c1e4d6eb1c76eeadce4a1fa3e101867a1 (diff) | |
download | latinime-80980574acfef74f9392da4fdbcba64d911cb66f.tar.gz latinime-80980574acfef74f9392da4fdbcba64d911cb66f.tar.xz latinime-80980574acfef74f9392da4fdbcba64d911cb66f.zip |
Fix test breakage
This CL also adds null analysis annotations to StringUtils.
Change-Id: I751932c1ed2579bc10f4584651b997356f180899
Diffstat (limited to 'tests/src')
-rw-r--r-- | tests/src/com/android/inputmethod/keyboard/layout/expected/ActualKeyboardBuilder.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/expected/ActualKeyboardBuilder.java b/tests/src/com/android/inputmethod/keyboard/layout/expected/ActualKeyboardBuilder.java index afc5448a3..2a040f564 100644 --- a/tests/src/com/android/inputmethod/keyboard/layout/expected/ActualKeyboardBuilder.java +++ b/tests/src/com/android/inputmethod/keyboard/layout/expected/ActualKeyboardBuilder.java @@ -25,6 +25,9 @@ import com.android.inputmethod.latin.common.StringUtils; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * This class builds an actual keyboard for unit test. * @@ -98,9 +101,13 @@ public final class ActualKeyboardBuilder extends AbstractKeyboardBuilder<Key> { @Override public String stringize(final MoreKeySpec spec) { + if (spec == null) { + return "null"; + } return toString(spec.mLabel, spec.mIconId, spec.mOutputText, spec.mCode); } + @Nonnull static String toString(final String label, final int iconId, final String outputText, final int code) { final String visual = (iconId != KeyboardIconsSet.ICON_UNDEFINED) @@ -125,7 +132,7 @@ public final class ActualKeyboardBuilder extends AbstractKeyboardBuilder<Key> { static final KeyStringizer STRINGIZER = new KeyStringizer(); @Override - public String stringize(final Key key) { + public String stringize(@Nullable final Key key) { if (key == null) { return "NULL"; } @@ -150,7 +157,8 @@ public final class ActualKeyboardBuilder extends AbstractKeyboardBuilder<Key> { * @param key the key to be converted to string. * @return the human readable representation of <code>key</code>. */ - public static String toString(final Key key) { + @Nonnull + public static String toString(@Nullable final Key key) { return KeyStringizer.STRINGIZER.stringize(key); } @@ -159,7 +167,8 @@ public final class ActualKeyboardBuilder extends AbstractKeyboardBuilder<Key> { * @param keys the keyboard row to be converted to string. * @return the human readable representation of <code>keys</code>. */ - public static String toString(final Key[] keys) { + @Nonnull + public static String toString(@Nullable final Key[] keys) { return KeyStringizer.STRINGIZER.join(keys); } @@ -168,7 +177,7 @@ public final class ActualKeyboardBuilder extends AbstractKeyboardBuilder<Key> { static final KeyArrayStringizer STRINGIZER = new KeyArrayStringizer(); @Override - public String stringize(final Key[] keyArray) { + public String stringize(@Nullable final Key[] keyArray) { return KeyStringizer.STRINGIZER.join(keyArray); } } @@ -178,7 +187,8 @@ public final class ActualKeyboardBuilder extends AbstractKeyboardBuilder<Key> { * @param rows the keyboard to be converted to string. * @return the human readable representation of <code>rows</code>. */ - public static String toString(final Key[][] rows) { + @Nonnull + public static String toString(@Nullable final Key[][] rows) { return KeyArrayStringizer.STRINGIZER.join(rows, "\n" /* delimiter */); } } |