コード例 #1
0
 private void assertDefaultPrimitiveTypeReturnValues(TestInterface testObject) {
   testObject.returnNothing();
   assertEquals(false, testObject.returnBoolean());
   assertEquals(0, testObject.returnChar());
   assertEquals(0, testObject.returnByte());
   assertEquals(0, testObject.returnShort());
   assertEquals(0, testObject.returnInt());
   assertEquals(0, testObject.returnLong());
   assertTrue(0 == testObject.returnDouble());
   assertTrue(0 == testObject.returnFloat());
 }
コード例 #2
0
  private void assertCanModifyReturnValueForPrimitiveType(TestInterface testObject) {
    Recorder<TestInterface> recorder = TestObject.createRecorder(testObject);

    boolean expectedBoolean = true;
    byte expectedByte = 9;
    char expectedChar = 10;
    short expectedShort = 11;
    int expectedInt = 12;
    long expectedLong = 13;
    float expectedFloat = 14.2f;
    double expectedDouble = 15.5d;
    recorder
        .record(testObject.returnBoolean())
        .andReturn(expectedBoolean)
        .record(testObject.returnByte())
        .andReturn(expectedByte)
        .record(testObject.returnChar())
        .andReturn(expectedChar)
        .record(testObject.returnShort())
        .andReturn(expectedShort)
        .record(testObject.returnInt())
        .andReturn(expectedInt)
        .record(testObject.returnLong())
        .andReturn(expectedLong)
        .record(testObject.returnFloat())
        .andReturn(expectedFloat)
        .record(testObject.returnDouble())
        .andReturn(expectedDouble);

    assertEquals(expectedBoolean, testObject.returnBoolean());
    assertEquals(expectedByte, testObject.returnByte());
    assertEquals(expectedChar, testObject.returnChar());
    assertEquals(expectedShort, testObject.returnShort());
    assertEquals(expectedInt, testObject.returnInt());
    assertEquals(expectedLong, testObject.returnLong());
    assertTrue(expectedFloat == testObject.returnFloat());
    assertTrue(expectedDouble == testObject.returnDouble());
  }