EntitySearchCriteria implements SearchCriteria { @Override public boolean isSatisfied(Class<?> cls) { Entity entity = cls.getAnnotation(Entity.class); if (entity != null) { this.inherited = entity.parents(); return true; } return this.inherited; }  @Override boolean isSatisfied(Class<?> cls);  }
@Test void isSatisfied() { EntitySearchCriteria criteria = new EntitySearchCriteria(); List<Field> fields = Search.getAllFields(BaseClass.class, criteria); assertEquals(0, fields.size()); criteria = new EntitySearchCriteria(); fields = Search.getAllFields(AnnotatedClass.class, criteria); assertEquals(1, fields.size()); criteria = new EntitySearchCriteria(); fields = Search.getAllFields(ParentedClass.class, criteria); assertEquals(2, fields.size()); SearchCriteria search = criteria; assertThrows(IllegalArgumentException.class, () -> Search.getAllFields(null, search)); assertThrows(IllegalArgumentException.class, () -> Search.getAllFields(BaseClass.class, null)); }