### Question:
StringToEncodedStringOfLimitedValuesConverter implements Converter, HasOptions { @Override public void validate(Object value) throws IOException { if (!(value instanceof String)) { throw new IOException("should be a string."); } JsonNode result = objectMapper.readTree((String) value); throwIfInvalid(result, this.allowedValues); } StringToEncodedStringOfLimitedValuesConverter(String... values); static void throwIfInvalid(JsonNode json, List<String> allowedValues); @Override String jsonToTinkerpop(JsonNode json); @Override TextNode tinkerpopToJson(Object value); String getGuiTypeId(); @Override String getUniqueTypeIdentifier(); @Override Collection<String> getOptions(); @Override void validate(Object value);  }### Answer:
@Test(expected = IOException.class) public void validateThrowsAnExceptionWhenTheValueIsNotAnExpectedValue() throws IOException { StringToEncodedStringOfLimitedValuesConverter instance = new StringToEncodedStringOfLimitedValuesConverter("val1", "val2"); instance.validate("\"val3\""); }
@Test public void validateDoesNothingWhenTheValueIsAnExpectedValue() throws IOException { StringToEncodedStringOfLimitedValuesConverter instance = new StringToEncodedStringOfLimitedValuesConverter("val1", "val2"); instance.validate("\"val2\""); }