### Question:
TypeCasting implements StackManipulation { public static StackManipulation to(TypeDefinition typeDefinition) { if (typeDefinition.isPrimitive()) { throw new IllegalArgumentException("Cannot cast to primitive type: " + typeDefinition); } return new TypeCasting(typeDefinition.asErasure()); } protected  TypeCasting(TypeDescription typeDescription); static StackManipulation to(TypeDefinition typeDefinition); boolean isValid(); Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testPrimitiveCastingThrowsException() throws Exception { when(typeDescription.isPrimitive()).thenReturn(true); TypeCasting.to(typeDescription); }