ClassUtils { public static boolean isPresent(String clazzName) { if (StringUtils.isEmpty(clazzName)) { return false; } boolean isPresent; try { @SuppressWarnings("unused") Class<?> clazz = Class.forName(clazzName); isPresent = true; } catch (ClassNotFoundException e) { isPresent = false; } return isPresent; }  static boolean isPresent(String clazzName);  }
@Test public void shouldReturnFalseWhenClassNameNull() { boolean isPresent = ClassUtils.isPresent(null ); assertThat(isPresent, is(false)); }
@Test public void shouldReturnFalseWhenClassNameEmpty() { boolean isPresent = ClassUtils.isPresent("" ); assertThat(isPresent, is(false)); }
@Test public void shouldReturnTrueWhenClassPresent() { String className = "java.io.IOException"; boolean isPresent = ClassUtils.isPresent(className); assertThat(isPresent, is(true)); }
@Test public void shouldReturnFalseWhenClassNotPresent() { String className = "aoamwogmAWEGAWEg.asdmgm"; boolean isPresent = ClassUtils.isPresent(className); assertThat(isPresent, is(false)); }