Пример #1
0
  @Test
  public void testReportsAFailureIfOuputIsUnexpected() throws Exception {
    Call call = new Call(new StaticInvocation(calculator, Calculator.ADD));
    call.addInput("3");
    call.expect(ShouldBe.equal(3));

    call.will(Annotate.wrong(annotatable)).when(ResultIs.wrong());
    call.execute();
    verify(annotatable).annotate(any(WrongAnnotation.class));
  }
Пример #2
0
  @Test
  public void testReportsASuccessIfOuputMatchesExpectation() throws Exception {
    Call call = new Call(new StaticInvocation(calculator, Calculator.SUM));
    call.addInput("5", "2");
    call.expect(ShouldBe.equal(7));

    call.will(Annotate.right(annotatable)).when(ResultIs.right());
    call.execute();
    verify(annotatable).annotate(any(RightAnnotation.class));
  }