QueryProcessor { protected boolean ignoreProperty(PropertyDescriptor descriptor) { if (descriptor != null && descriptor.getReadMethod() != null) { if (descriptor.getReadMethod().isAnnotationPresent(JsonIgnore.class)) { return descriptor.getReadMethod().getAnnotation(JsonIgnore.class).value(); } return false; } return true; }  abstract boolean supports(Class<? extends Query<?>> query); List<Property<T>> process(Query query, T instance, Class<T> instanceClazz);  }
@Test public void doNotIgnoreMethodsWithoutIgnoreAnnotations() { PropertyDescriptor descriptor = ClassUtil.getReadableProperty("property1", MockModel.class); MockQueryProcessor processor = new MockQueryProcessor(); assertFalse(processor.ignoreProperty(descriptor)); }
@Test public void ignoreMethodsAnnotatedWithCatnapIgnore() { PropertyDescriptor descriptor = ClassUtil.getReadableProperty("property2", MockModel.class); MockQueryProcessor processor = new MockQueryProcessor(); assertTrue(processor.ignoreProperty(descriptor)); }
@Test public void ignoreMethodsAnnotatedWithJsonIgnore() { PropertyDescriptor descriptor = ClassUtil.getReadableProperty("property3", MockModel.class); MockQueryProcessor processor = new MockQueryProcessor(); assertTrue(processor.ignoreProperty(descriptor)); }
@Test public void ignoreMethodsWithoutGetters() { PropertyDescriptor descriptor = ClassUtil.getReadableProperty("property4", MockModel.class); MockQueryProcessor processor = new MockQueryProcessor(); assertTrue(processor.ignoreProperty(descriptor)); }
@Test public void ignoreMethodsWithNullDescriptors() { MockQueryProcessor processor = new MockQueryProcessor(); assertTrue(processor.ignoreProperty(null)); }