fixed unit test

This commit is contained in:
Sebastian Stenzel
2020-02-20 00:28:48 +01:00
parent d7edfd13a7
commit 97dfe9a1d4

View File

@@ -79,8 +79,7 @@ class WordEncoder {
* @throws IllegalArgumentException If the encoded string doesn't consist of a multiple of two words or one of the words is unknown to this encoder.
*/
public byte[] decode(String encoded) {
Preconditions.checkArgument(!Strings.isNullOrEmpty(encoded));
List<String> splitted = Splitter.on(DELIMITER).omitEmptyStrings().splitToList(encoded);
List<String> splitted = Splitter.on(DELIMITER).omitEmptyStrings().splitToList(Strings.nullToEmpty(encoded));
Preconditions.checkArgument(splitted.size() % 2 == 0, "%s needs to be a multiple of two words", encoded);
byte[] result = new byte[splitted.size() / 2 * 3];
for (int i = 0; i < splitted.size(); i+=2) {