GenericsUtil { public static boolean isLog4jLogger(Class<?> clazz) { if (clazz == null) { return false; } Logger log = LoggerFactory.getLogger(clazz); return log instanceof Log4jLoggerAdapter; }  static Class<T> getClass(T t); static T[] toArray(Class<T> c, List<T> list); static T[] toArray(List<T> list); static boolean isLog4jLogger(Class<?> clazz);  }
@Test public void testIsLog4jLogger() throws Exception { assertFalse("False if clazz is null", GenericsUtil.isLog4jLogger(null)); assertTrue("The implementation is Log4j", GenericsUtil.isLog4jLogger(TestGenericsUtil.class)); }