@Test(expected = IllegalArgumentException.class) public void testPrimitiveCastingThrowsException() throws Exception { when(typeDescription.isPrimitive()).thenReturn(true); TypeCasting.to(typeDescription); }
public static StackManipulation to(TypeDefinition typeDefinition) { if (typeDefinition.isPrimitive()) { throw new IllegalArgumentException("Cannot cast to primitive type: " + typeDefinition); } return new TypeCasting(typeDefinition.asErasure()); }
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()); } }
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); }
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); }
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);  }