### Question:
UnknownModeException extends RuntimeException { @Override public String getMessage() { StringBuilder sb = new StringBuilder(); sb .append("An unknown mode was found in the command line arguments: `") .append(candidate) .append("`.\n\n") .append("The possible choices are (they are case-sensitive):\n"); for (Object e : modeClass.getEnumConstants()) { sb .append("\t- ") .append(e) .append("\n"); } return sb.toString(); } UnknownModeException(
            Class modeClass,
            String candidate); @Override String getMessage();  }### Answer:
@Test public void message_contains_candidate() { assertThat(exception.getMessage(), containsString(candidate)); }
@Test public void message_lists_possible_enums() { for (TestModes mode : TestModes.values()) { assertThat(exception.getMessage(), containsString(mode.toString())); } }