TypeOfFunction implements Function<Boolean> { @Override public Set<String> validateInput(List<Object> args) { if (args.size() != 2) { return Collections.singleton("Two arguments are required: value and type to check against"); } Object desiredColumnType = args.get(1); Optional<DataType> dataTypeCandidate = getDataType(desiredColumnType); if (!dataTypeCandidate.isPresent()) { return Collections.singleton(String.format("Invalid data type \"%s\": should be one of {%s}", desiredColumnType, ENUMERATED_COLUMN_TYPES)); } return Collections.emptySet(); }  @Override Set<String> validateInput(List<Object> args); @Override Class<Boolean> getReturnType(); @Override FunctionName getName(); @Override Boolean apply(List<Object> objects); @Override String getSignature(); @Override String getDescription();  }
@Test public void testValidateInput() throws Exception { assertThat(function.validateInput(Collections.emptyList()), is(not(empty()))); assertThat(function.validateInput(Collections.singletonList(1)), is(not(empty()))); assertThat(function.validateInput(Arrays.asList(1, INTEGER)), is(empty())); }