Пример #1
0
  @Test
  public void recordExpectationsOnStaticMethodAndConstructorOfFinalLocalMockField() {
    new Expectations() {
      @NonStrict final YetAnotherCollaborator unused = null;

      {
        new YetAnotherCollaborator(true);
        result = new RuntimeException();
        YetAnotherCollaborator.doSomethingStatic();
        result = 123;
      }
    };

    try {
      new YetAnotherCollaborator(true);
      fail();
    } catch (RuntimeException ignore) {
    }

    assertEquals(123, YetAnotherCollaborator.doSomethingStatic());
  }