NoIdAsAttributeName implements FactoryStyleValidation { @Override public Optional<String> validateFactory() { boolean valid = !attributeField.getName().equals("id"); if (!valid) { return Optional.of("'id' is not a valid attribute name, because of name conflicts in json"); } else { return Optional.empty(); } } NoIdAsAttributeName(Field attributeField); @Override Optional<String> validateFactory();  }
@Test public void test() throws NoSuchFieldException { Optional<String> result = new NoIdAsAttributeName(NotIdFactory.class.getField("id")).validateFactory(); Assertions.assertTrue(result.isPresent()); }