### Question:
Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); }  void register(@Nonnull final Class<T> type, @Nonnull final Conversion<T, ?> factory); void register(@Nonnull final TypeToken<T> type,
            @Nonnull final Conversion<T, ?> factory); void registerDate(@Nonnull final String pattern); @Nonnull T convert(@Nonnull final Class<T> type, @Nonnull final String value); @SuppressWarnings("unchecked") @Nonnull T convert(@Nonnull final TypeToken<T> type, @Nonnull final String value); @Nonnull Set<TypeToken<?>> registered();  }### Answer:
@Test public void shouldConvertString() throws Exception { assertThat("bob", is(equalTo(converter.convert(String.class, "bob")))); }
@Test public void shouldConvertRegistered() throws Exception { assertThat(Paths.get("/dev/null"), is(equalTo(converter.convert(Path.class, "/dev/null")))); }
@Test public void shouldConvertWithValueOf() throws Exception { assertThat(3, is(equalTo(converter.convert(Integer.class, "3")))); }
@Test public void shouldConvertWithOf() throws Exception { assertThat(UTC, is(equalTo(converter.convert(ZoneOffset.class, "Z")))); }
@Test public void shouldConvertWithNew() throws Exception { assertThat(new File("/dev/null"), is(equalTo(converter.convert(File.class, "/dev/null")))); }
@Test public void shouldConvertToResourceList() throws Exception { final String path = format("classpath:/%s.class", getClass().getName().replace('.', '/')); final List<Resource> resources = asList( new PathMatchingResourcePatternResolver().getResources(path)); assertThat(resources, is(equalTo(converter.convert(new TypeToken<List<Resource>>() { }, path)))); }
@Test(expected = UnsupportedConversion.class) public void shouldThrowWhenUnsupported() throws Exception { converter.convert(Package.class, getClass().getPackage().getName()); }