### Question:
ReflectionUtil { public static Set<Field> getHibersapSessionFields(final Object target) { HashSet<Field> fields = new HashSet<>(); Field[] declaredFields = target.getClass().getDeclaredFields(); for (Field declaredField : declaredFields) { if (declaredField.getAnnotation(HibersapSession.class) != null) { fields.add(declaredField); } } return fields; } private  ReflectionUtil(); static Set<Field> getHibersapSessionFields(final Object target); static String getSessionManagerJndiName(final Field sessionField); static void injectSessionIntoTarget(final Object target, final Field field, final Session session);  }### Answer:
@Test public void getSessionFieldReturnsEmptySetWhenObjectDoesNotContainAnyFieldWithHibersapSessionAnnotation() { Set<Field> fields = ReflectionUtil.getHibersapSessionFields(new Object()); assertThat(fields).isNotNull(); assertThat(fields).hasSize(0); }
@Test public void getSessionFieldReturnsFieldWithHibersapSessionAnnotation() { Set<Field> fields = ReflectionUtil.getHibersapSessionFields(new TestBean()); assertThat(fields).hasSize(2); }