TaggedConverter implements Converter { @Override public void convert(Object source, Object target, String... tags) throws JTransfoException { Converter converter = converters.get(MapOnly.ALWAYS); if (null != converter) { converter.convert(source, target, tags); } if (!notConverters.isEmpty()) { for (Map.Entry<String, Converter> entry : notConverters.entrySet()) { if (!contains(tags, entry.getKey())) { entry.getValue().convert(source, target, tags); } } } if (null != tags) { for (String tag : tags) { converter = converters.get(tag); if (null != converter) { converter.convert(source, target, tags); } } } }  void addConverters(Converter converter, String... tags); @Override void convert(Object source, Object target, String... tags);  }
@Test public void testConvert() throws Exception { Converter starConverter = mock(Converter.class); Converter converter = mock(Converter.class); taggedConverter.addConverters(converter, TAG); taggedConverter.addConverters(starConverter, MapOnly.ALWAYS); Object source = mock(Object.class); Object target = mock(Object.class); taggedConverter.convert(source, target); verifyNoMoreInteractions(converter); verify(starConverter).convert(source, target); }