### Question:
TypeUtils { public static TypeToken<?> resolveTypeName(String type) { Preconditions.checkArgument(type.length() > 0, "type name is empty"); if (type.endsWith("[]")) { String nt = type.substring(0, type.length() - 2); TypeToken<?> inner = resolveTypeName(nt); return makeListType(inner); } switch (type) { case "string": case "String": return TypeToken.of(String.class); case "int": case "Integer": return TypeToken.of(Integer.class); case "long": case "Long": return TypeToken.of(Long.class); case "double": case "real": case "Double": return TypeToken.of(Double.class); case "text": case "Text": return TypeToken.of(Text.class); default: try { return TypeToken.of(ClassUtils.getClass(type)); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("Cannot load type name ", e); } } } private  TypeUtils(); static Set<Class<?>> typeClosure(Class<?> type); static TypeToken<List<T>> makeListType(TypeToken<T> element); @SuppressWarnings("unchecked") static TypeToken<T> listElementType(TypeToken<? extends List<T>> token); static TypeToken<?> resolveTypeName(String type); @SuppressWarnings("unchecked") static String makeTypeName(TypeToken<T> type); @SuppressWarnings("unchecked") static FromStringConverter<T> lookupFromStringConverter(TypeToken<T> type);  }### Answer:
@Test public void testResolveTextType() { assertThat(resolveTypeName("text"), equalTo((TypeToken) TypeToken.of(Text.class))); assertThat(resolveTypeName("Text"), equalTo((TypeToken) TypeToken.of(Text.class))); }
@Test public void testResolveStringType() { assertThat(resolveTypeName("string"), equalTo((TypeToken) TypeToken.of(String.class))); assertThat(resolveTypeName("String"), equalTo((TypeToken) TypeToken.of(String.class))); }
@Test public void testResolveNumericTypes() { assertThat(resolveTypeName("double"), equalTo((TypeToken) TypeToken.of(Double.class))); assertThat(resolveTypeName("Double"), equalTo((TypeToken) TypeToken.of(Double.class))); assertThat(resolveTypeName("long"), equalTo((TypeToken) TypeToken.of(Long.class))); assertThat(resolveTypeName("Long"), equalTo((TypeToken) TypeToken.of(Long.class))); assertThat(resolveTypeName("int"), equalTo((TypeToken) TypeToken.of(Integer.class))); assertThat(resolveTypeName("Integer"), equalTo((TypeToken) TypeToken.of(Integer.class))); assertThat(resolveTypeName("real"), equalTo((TypeToken) TypeToken.of(Double.class))); }
@Test public void testResolveClassType() { assertThat(resolveTypeName("java.io.File"), equalTo((TypeToken) TypeToken.of(File.class))); }
@Test public void testParseListType() { TypeToken<List<String>> strList = new TypeToken<List<String>>() {}; assertThat(resolveTypeName("string[]"), equalTo((TypeToken) strList)); assertThat(resolveTypeName("int[]"), equalTo((TypeToken) new TypeToken<List<Integer>>(){})); assertThat(resolveTypeName("int[][]"), equalTo((TypeToken) new TypeToken<List<List<Integer>>>(){})); }