MockType (final MockVirtualMachine virtualMachine, Class aClass) { if (aClass.isPrimitive()) { if (aClass == boolean.class) { return virtualMachine.getBooleanType(); } if (aClass == int.class) { return virtualMachine.getIntType(); } if (aClass == long.class) { return virtualMachine.getLongType(); } if (aClass == short.class) { return virtualMachine.getShortType(); } if (aClass == void.class) { return virtualMachine.getVoidType(); } throw new UnsupportedOperationException("create type for " + aClass); } return virtualMachine.createReferenceType(aClass); }