ConverterHelper { List<MapOnly> getMapOnlies(Field field) { List<MapOnly> mapOnly = reflectionHelper.getAnnotationWithMeta(field, MapOnly.class); List<MapOnlies> mapOnlies = reflectionHelper.getAnnotationWithMeta(field, MapOnlies.class); if (0 == mapOnly.size() && 0 == mapOnlies.size()) { return null; } List<MapOnly> res = new ArrayList<>(); res.addAll(mapOnly); mapOnlies.forEach(mo -> Collections.addAll(res, mo.value())); return res; }  ToConverter getToConverter(Class toClass, Class domainClass);  }
@Test public void testGetMapOnlies_both() throws Exception { Field field = TaggedPersonTo.class.getDeclaredField("gender"); field.setAccessible(true); List<MapOnly> res = converterHelper.getMapOnlies(field); assertThat(res).hasSize(2); }
@Test public void testGetMapOnlies_mapOnlies() throws Exception { Field field = TaggedPersonTo.class.getDeclaredField("name"); field.setAccessible(true); List<MapOnly> res = converterHelper.getMapOnlies(field); assertThat(res).hasSize(2); }
@Test public void testGetMapOnlies_none() throws Exception { Field field = TaggedPersonTo.class.getDeclaredField("lastChanged"); field.setAccessible(true); List<MapOnly> res = converterHelper.getMapOnlies(field); assertThat(res).isNull(); }