### Question:
Validator { public void checkMD5(String input) { if (input == null || !md5.matcher(input).matches()) { throw new IllegalArgumentException(String.format("Hash is invalid: '%s'", input)); } } Validator(); void checkPlayerId(String input); boolean isReadableName(String input); boolean isNickName(String input); boolean isFullName(String input); void checkPlayerId(String input, boolean canBeNull); boolean isPlayerId(String input, boolean canBeNull); boolean isEmail(String input, boolean canBeNull); void checkEmail(String input, boolean canBeNull); boolean isCode(String input, boolean canBeNull); void checkCode(String input, boolean canBeNull); boolean isEmpty(String input); boolean isGameName(String input, boolean canBeNull); boolean isRoomName(String input, boolean canBeNull); boolean is(String input, boolean canBeNull, Pattern pattern); void checkRoomName(String input, boolean canBeNull); void checkGameName(String input, boolean canBeNull); void checkNotEmpty(String name, String input); GameType checkGameType(String input); void checkMD5(String input); void checkCommand(String input); void checkPlayerCode(String id, String code); void checkNotNull(String name, Object input); void checkPlayerInRoom(String id, String roomName); static final boolean CAN_BE_NULL; static final boolean CANT_BE_NULL; }### Answer:
@Test public void validateCheckMd5() { shouldError("Hash is invalid: 'null'", () -> validator.checkMD5(null)); shouldError("Hash is invalid: ''", () -> validator.checkMD5("")); shouldError("Hash is invalid: 'NuLL'", () -> validator.checkMD5("NuLL")); shouldError("Hash is invalid: 'null'", () -> validator.checkMD5("null")); shouldError("Hash is invalid: 'NULL'", () -> validator.checkMD5("NULL")); shouldError("Hash is invalid: '*F(@DF^@(&@DF(@^'", () -> validator.checkMD5("*F(@DF^@(&@DF(@^")); shouldError("Hash is invalid: 'too large aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'", () -> validator.checkMD5("too large aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")); shouldError("Hash is invalid: '3-13dc7cb57f02b9c7c066b9e34b6fe72'", () -> validator.checkMD5("3-13dc7cb57f02b9c7c066b9e34b6fe72")); shouldError("Hash is invalid: '3_13dc7cb57f02b9c7c066b9e34b6fe72'", () -> validator.checkMD5("3_13dc7cb57f02b9c7c066b9e34b6fe72")); shouldError("Hash is invalid: '3.13dc7cb57f02b9c7c066b9e34b6fe72'", () -> validator.checkMD5("3.13dc7cb57f02b9c7c066b9e34b6fe72")); shouldError("Hash is invalid: '1'", () -> validator.checkMD5("1")); shouldError("Hash is invalid: '0'", () -> validator.checkMD5("0")); shouldError("Hash is invalid: '434589345613405760956134056340596345903465'", () -> validator.checkMD5("434589345613405760956134056340596345903465")); shouldOk(() -> validator.checkMD5("313dc7cb57f02b9c7c066b9e34b6fe72")); shouldError("Hash is invalid: 'some@email.com'", () -> validator.checkMD5("some@email.com")); }