### Question:
DebugSectionUtils { static <T> T castToTypeOrNull(Object object, Class<T> clazz) { return clazz.isInstance(object) ? clazz.cast(object) : null; } private  DebugSectionUtils();   }### Answer:
@Test public void shouldCastOrReturnNull() { assertThat(DebugSectionUtils.castToTypeOrNull("test", String.class), equalTo("test")); assertThat(DebugSectionUtils.castToTypeOrNull("test", Integer.class), nullValue()); assertThat(DebugSectionUtils.castToTypeOrNull(5, String.class), nullValue()); assertThat(DebugSectionUtils.castToTypeOrNull(5, Integer.class), equalTo(5)); }