### Question:
MapToObjectReflectionConverter implements Converter<Map<String, String>, T> { @Override public T convert(final Map<String, String> source) { try { final T mappedType = type.newInstance(); for (final Entry<String, String> entry : source.entrySet()) { try { final Field fieldName = type.getDeclaredField(entry.getKey()); fieldName.setAccessible(true); fieldName.set(mappedType, entry.getValue()); } catch (final NoSuchFieldException e) { } catch (final SecurityException e) { throw new AssertionError("Failed to populate type: " + type, e); } } return mappedType; } catch (final InstantiationException | IllegalAccessException e) { throw new IllegalArgumentException(type.getClass().getName() + " should have a public no-arguments constructor.", e); } } MapToObjectReflectionConverter(final Class<T> type); @Override T convert(final Map<String, String> source);  }### Answer:
@Test public void test() { final MapToObjectReflectionConverter<MyObject> converter = new MapToObjectReflectionConverter<>(MyObject.class); final MyObject actual = converter.convert(source); Assert.assertEquals(expected, actual); }
@Test(expected = IllegalArgumentException.class) public void convertedClassesMustHaveNoArgsConstructor() { new MapToObjectReflectionConverter<>(ClassWithoutNoArgsConstructor.class).convert(source); }