### Question:
Classes { @SuppressWarnings("unchecked") public static <T> T from(Object implementor) { try { return (T) implementor; } catch (ClassCastException e) { throw new DeveloperError(implementor.toString() + " does not inherit / implement the wanted interface", e); } } private  Classes(); @SuppressWarnings("unchecked") static T from(Object implementor);  }### Answer:
@Test public void testCastingIsWorking() { Object object = new Integer(0); Integer integer = Classes.from(object); assertThat(integer, instanceOf(Integer.class)); }
@Test(expected = ClassCastException.class) public void testThatAWrongCastingThrowsAnException() { Object object = new Object(); Integer integer = Classes.from(object); }