### Question:
PrettyTypes { public static String format(String message, Object... args) { Object[] prettyArgs = new Object[args.length]; for (int i = 0; i < args.length; ++i) { Object arg = args[i]; Object prettyArg; if (arg instanceof Class) { prettyArg = format((Class<?>)arg); } else if (arg instanceof Key) { prettyArg = format((Key<?>)arg); } else { prettyArg = arg; } prettyArgs[i] = prettyArg; } return String.format(message, prettyArgs); } private  PrettyTypes(); static String format(String message, Object... args);  }### Answer:
@Test public void testClasses() { assertThat(PrettyTypes.format("Class is %s", PrettyTypesTest.class), equalTo("Class is com.tavianator.sangria.core.PrettyTypesTest")); assertThat(PrettyTypes.format("Class is %s", Simple.class), equalTo("Class is com.tavianator.sangria.core.PrettyTypesTest.Simple")); }
@Test public void testTypeLiterals() { assertThat(PrettyTypes.format("TypeLiteral is %s", new TypeLiteral<List<String>>() { }), equalTo("TypeLiteral is java.util.List<java.lang.String>")); }
@Test public void testKeys() { assertThat(PrettyTypes.format("Key is %s", new Key<List<String>>() { }), equalTo("Key is java.util.List<java.lang.String>")); assertThat(PrettyTypes.format("Key is %s", new Key<List<String>>(Names.named("test")) { }), equalTo("Key is java.util.List<java.lang.String> annotated with @com.google.inject.name.Named(value=test)")); assertThat(PrettyTypes.format("Key is %s", new Key<List<String>>(Simple.class) { }), equalTo("Key is java.util.List<java.lang.String> annotated with @com.tavianator.sangria.core.PrettyTypesTest.Simple")); }