예제 #1
0
  @org.junit.Test
  public void notifiesListenerOfEvents() {
    final TestListener listener = context.mock(TestListener.class);
    test.addTestListener(listener);

    final TestDescriptor testDescriptor = context.mock(TestDescriptor.class);

    context.checking(
        new Expectations() {
          {
            one(listener).beforeSuite(testDescriptor);
          }
        });

    test.getTestListenerBroadcaster().getSource().beforeSuite(testDescriptor);
  }
예제 #2
0
  @org.junit.Test
  public void notifiesListenerBeforeTest() {
    final TestClosure closure = context.mock(TestClosure.class);
    test.beforeTest(TestUtil.toClosure(closure));

    final TestDescriptor testDescriptor = context.mock(TestDescriptor.class);

    context.checking(
        new Expectations() {
          {
            one(closure).call(testDescriptor);
          }
        });

    test.getTestListenerBroadcaster().getSource().beforeTest(testDescriptor);
  }
예제 #3
0
파일: TestTest.java 프로젝트: peas/gradle
  @org.junit.Test
  public void notifiesListenerAfterTest() {
    final TestClosure closure = context.mock(TestClosure.class);
    test.afterTest(HelperUtil.toClosure(closure));

    final TestDescriptor testDescriptor = context.mock(TestDescriptor.class);
    final TestResult result = context.mock(TestResult.class);

    context.checking(
        new Expectations() {
          {
            one(closure).call(testDescriptor);
          }
        });

    test.getTestListenerBroadcaster().getSource().afterTest(testDescriptor, result);
  }