@VisibleForTesting Set<Field> getLoggerFieldsAnnotatedWithResource(Class<?> declaredType) { Set<Field> fields = Sets.newHashSet(); Class<?> type = declaredType; while (type != null) { fields.addAll(Arrays.asList(type.getDeclaredFields())); type = type.getSuperclass(); } return filter(fields, new LoggerFieldsAnnotatedWithResource()); } }
@VisibleForTesting Set<Field> getLoggerFieldsAnnotatedWithResource(Class<?> declaredType) { Set<Field> fields = Sets.newHashSet(); Class<?> type = declaredType; while (type != null) { fields.addAll(Arrays.asList(type.getDeclaredFields())); type = type.getSuperclass(); } return filter(fields, new LoggerFieldsAnnotatedWithResource()); } }
@VisibleForTesting Set<Field> getLoggerFieldsAnnotatedWithResource(Class<?> declaredType) { Set<Field> fields = Sets.newHashSet(); Class<?> type = declaredType; while (type != null) { fields.addAll(Arrays.asList(type.getDeclaredFields())); type = type.getSuperclass(); } return filter(fields, new LoggerFieldsAnnotatedWithResource()); } }
@Test public void testLoggerFieldsAnnotatedWithResource() throws SecurityException, NoSuchFieldException { LoggerFieldsAnnotatedWithResource predicate = new LoggerFieldsAnnotatedWithResource(); assert predicate.apply(A.class.getDeclaredField("logger")); }
@Test public void testLoggerFieldsAnnotatedWithInjectReturnsNull() throws SecurityException, NoSuchFieldException { LoggerFieldsAnnotatedWithResource predicate = new LoggerFieldsAnnotatedWithResource(); assert !predicate.apply(C.class.getDeclaredField("logger")); }
@VisibleForTesting Set<Field> getLoggerFieldsAnnotatedWithResource(Class<?> declaredType) { Set<Field> fields = Sets.newHashSet(); Class<?> type = declaredType; while (type != null) { fields.addAll(Arrays.asList(type.getDeclaredFields())); type = type.getSuperclass(); } return filter(fields, new LoggerFieldsAnnotatedWithResource()); } }
@VisibleForTesting Set<Field> getLoggerFieldsAnnotatedWithResource(Class<?> declaredType) { Set<Field> fields = Sets.newHashSet(); Class<?> type = declaredType; while (type != null) { fields.addAll(Arrays.asList(type.getDeclaredFields())); type = type.getSuperclass(); } return filter(fields, new LoggerFieldsAnnotatedWithResource()); } }
@VisibleForTesting Set<Field> getLoggerFieldsAnnotatedWithResource(Class<?> declaredType) { Set<Field> fields = Sets.newHashSet(); Class<?> type = declaredType; while (type != null) { fields.addAll(Arrays.asList(type.getDeclaredFields())); type = type.getSuperclass(); } return filter(fields, new LoggerFieldsAnnotatedWithResource()); } }
@Test public void testLoggerFieldsAnnotatedWithInjectReturnsNull() throws SecurityException, NoSuchFieldException { LoggerFieldsAnnotatedWithResource predicate = new LoggerFieldsAnnotatedWithResource(); assert !predicate.apply(C.class.getDeclaredField("logger")); }
@Test public void testLoggerFieldsAnnotatedWithResource() throws SecurityException, NoSuchFieldException { LoggerFieldsAnnotatedWithResource predicate = new LoggerFieldsAnnotatedWithResource(); assert predicate.apply(A.class.getDeclaredField("logger")); }