Evaluator { @SuppressWarnings("unchecked") public static <T> T getConditionReturnValue() { if (!contractReturnType.get().isPrimitive()) { return null; } return (T) primitiveReturnValues.get(contractReturnType.get()); }  @SuppressWarnings("unchecked") static T getCurrentTarget(); static boolean isBefore(); static boolean isAfter(); @SuppressWarnings("unchecked") static T getReturnValue(); static Object getPreCondition(Object target, String methodName, Class<?> contractClass,
			Class<?> callingClass, Class<?> returnType); static boolean canExecutePostCondition(); static boolean canExecuteCondition(); static Object getInvariant(Object target, String className, Class<?> contractClass, Class<?> callingClass); static void beforeContractMethod(); static Object getPostCondition(Object target, String methodName, Class<?> contractClass,
			Class<?> callingClass, Class<?> returnType, Object actualReturnValue); static Object getInitializationCall(Object target, String methodName, Class<?> contractClass,
			Class<?> callingClass); static void afterContract(); static void afterContractMethod(); @SuppressWarnings("unchecked") static T getConditionReturnValue(); static void setException(Throwable t); @SuppressWarnings("unchecked") static T getException(); static final StaticCall isBefore; static final String isBeforeDescriptor; static final StaticCall isAfter; static final StaticCall getReturnValue; static final StaticCall getCurrentTarget; static final StaticCall getPreCondition; static final StaticCall getPostCondition; static final StaticCall getInitializationCall; static final StaticCall getInvariant; static final StaticCall canExecuteCondition; static final StaticCall canExecutePostCondition; static final StaticCall beforeContractMethod; static final StaticCall afterContract; static final StaticCall afterContractMethod; static final StaticCall setException; }
@Test public void testGetConditionReturnValue() { Evaluator.contractReturnType.set(String.class); assertNull(Evaluator.getConditionReturnValue()); Evaluator.contractReturnType.set(long.class); assertEquals(Long.valueOf(0), Evaluator.getConditionReturnValue()); Evaluator.contractReturnType.set(int.class); assertEquals(Integer.valueOf(0), Evaluator.getConditionReturnValue()); Evaluator.contractReturnType.set(short.class); assertEquals(Short.valueOf((short) 0), Evaluator.getConditionReturnValue()); Evaluator.contractReturnType.set(char.class); assertEquals(Character.valueOf((char) 0), Evaluator.getConditionReturnValue()); Evaluator.contractReturnType.set(byte.class); assertEquals(Byte.valueOf((byte) 0), Evaluator.getConditionReturnValue()); Evaluator.contractReturnType.set(double.class); assertEquals(Double.valueOf(0), Evaluator.getConditionReturnValue()); Evaluator.contractReturnType.set(float.class); assertEquals(Float.valueOf(0), Evaluator.getConditionReturnValue()); Evaluator.contractReturnType.set(boolean.class); assertEquals(Boolean.FALSE, Evaluator.getConditionReturnValue()); }