### Question:
OverriddenToStringPrinter extends ToStringPrinter { @Override public boolean supports(Class<?> clazz) { if (clazz.isPrimitive()) { return true; } if (clazz.isInterface()) { return clazz.isAnnotation(); } if (clazz.isEnum()) { return true; } return !ReflectionUtils.findMethod(clazz, "toString").getDeclaringClass().equals(Object.class); }  @Override boolean supports(Class<?> clazz);  }### Answer:
@Test public void supportsPrimitives() { Class<?> booleanClass = boolean.class; Class<?> byteClass = byte.class; Class<?> shortClass = short.class; Class<?> charClass = char.class; Class<?> intClass = int.class; Class<?> longClass = long.class; Class<?> floatClass = float.class; Class<?> doubleClass = double.class; boolean supportsBoolean = printer.supports(booleanClass); boolean supportsByte = printer.supports(byteClass); boolean supportsShort = printer.supports(shortClass); boolean supportsChar = printer.supports(charClass); boolean supportsInt = printer.supports(intClass); boolean supportsLong = printer.supports(longClass); boolean supportsFloat = printer.supports(floatClass); boolean supportsDouble = printer.supports(doubleClass); assertTrue(supportsBoolean); assertTrue(supportsByte); assertTrue(supportsShort); assertTrue(supportsChar); assertTrue(supportsInt); assertTrue(supportsLong); assertTrue(supportsFloat); assertTrue(supportsDouble); }
@Test public void supportsPrimitiveWrappers() { Class<?> booleanClass = Boolean.class; Class<?> byteClass = Byte.class; Class<?> shortClass = Short.class; Class<?> charClass = Character.class; Class<?> intClass = Integer.class; Class<?> longClass = Long.class; Class<?> floatClass = Float.class; Class<?> doubleClass = Double.class; boolean supportsBoolean = printer.supports(booleanClass); boolean supportsByte = printer.supports(byteClass); boolean supportsShort = printer.supports(shortClass); boolean supportsChar = printer.supports(charClass); boolean supportsInt = printer.supports(intClass); boolean supportsLong = printer.supports(longClass); boolean supportsFloat = printer.supports(floatClass); boolean supportsDouble = printer.supports(doubleClass); assertTrue(supportsBoolean); assertTrue(supportsByte); assertTrue(supportsShort); assertTrue(supportsChar); assertTrue(supportsInt); assertTrue(supportsLong); assertTrue(supportsFloat); assertTrue(supportsDouble); }
@Test public void supportsVoid() { Class<?> clazz = void.class; boolean supports = printer.supports(clazz); assertTrue(supports); }
@Test public void supportsVoidObject() { Class<?> clazz = Void.class; boolean supports = printer.supports(clazz); assertFalse(supports); }
@Test public void supportsString() { Class<?> clazz = String.class; boolean supports = printer.supports(clazz); assertTrue(supports); }
@Test public void supportsObject() { Class<?> clazz = Object.class; boolean supports = printer.supports(clazz); assertFalse(supports); }
@Test public void supportsInterface() { Class<?> clazz = Serializable.class; boolean supports = printer.supports(clazz); assertFalse(supports); }
@Test public void supportsEnum() { Class<?> clazz = LogLevel.class; boolean supports = printer.supports(clazz); assertTrue(supports); }
@Test public void supportsArray() { Class<?> clazz = String[].class; boolean supports = printer.supports(clazz); assertFalse(supports); }
@Test public void supportsAbstractClass() { Class<?> clazz = AbstractClass.class; boolean supports = printer.supports(clazz); assertTrue(supports); }
@Test public void supportsAnnotation() throws NoSuchMethodException { Class<?> clazz = Test.class; boolean supports = printer.supports(clazz); assertTrue(supports); }