Пример #1
0
  private void assertThrowOnVoidMethod(TestInterface testObject) {
    Recorder<TestInterface> recorder = TestObject.createRecorder(testObject);

    testObject.returnNothing();
    recorder.recordForLastCall().andThrow(new RuntimeException());

    testObject.returnNothing();
  }
Пример #2
0
  private void assertVoidMethodWithParamMatching(TestInterface testObject) {
    Recorder<TestInterface> recorder = new Recorder<TestInterface>(testObject);

    String arg = "arg";
    testObject.methodWithArguments(arg);
    recorder.recordForLastCall().andThrow(new RuntimeException());

    testObject.methodWithArguments("otherstring");
    testObject.methodWithArguments(arg);
  }
Пример #3
0
  private void assertDoesNotAllowWrongTypeException(TestInterface testObject) throws IOException {
    Recorder<TestInterface> recorder = TestObject.createRecorder(testObject);

    testObject.throwDeclardeException();
    recorder.recordForLastCall().andThrow(new Exception());
  }