summaryrefslogtreecommitdiffstats
path: root/junit4/src/test/java/org/junit/tests/junit3compatibility/OldTestClassAdaptingListenerTest.java
blob: 8c68a1a7bfdba7baf8bb7fb91637cca063585736 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package org.junit.tests.junit3compatibility;

import static org.junit.Assert.assertEquals;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import junit.framework.TestListener;
import org.junit.Test;
import org.junit.internal.runners.JUnit38ClassRunner;
import org.junit.runner.Result;
import org.junit.runner.notification.RunListener;
import org.junit.runner.notification.RunNotifier;

public class OldTestClassAdaptingListenerTest {
	@Test
	public void addFailureDelegatesToNotifier() {
		Result result= new Result();
		RunListener listener= result.createListener();
		RunNotifier notifier= new RunNotifier();
		notifier.addFirstListener(listener);
		TestCase testCase= new TestCase() {
		};
		TestListener adaptingListener= new JUnit38ClassRunner(testCase)
				.createAdaptingListener(notifier);
		adaptingListener.addFailure(testCase, new AssertionFailedError());
		assertEquals(1, result.getFailureCount());
	}
}