|
15 | 15 |
|
16 | 16 | public class ExceptionFactoryTest { |
17 | 17 |
|
18 | | - private static ClassLoader classLoaderWithoutJUnitOrOpenTest = |
| 18 | + private static final ClassLoader classLoaderWithoutJUnitOrOpenTest = |
19 | 19 | excludingClassLoader() |
20 | 20 | .withCodeSourceUrlOf(ExceptionFactory.class) |
21 | 21 | .without("org.junit", "junit", "org.opentest4j") |
22 | 22 | .build(); |
23 | | - private static ClassLoader classLoaderWithoutOpenTest = |
24 | | - excludingClassLoader() |
25 | | - .withCodeSourceUrlOf(ExceptionFactory.class, org.junit.ComparisonFailure.class) |
26 | | - .without("org.opentest4j") |
27 | | - .build(); |
28 | | - private static ClassLoader currentClassLoader = ExceptionFactoryTest.class.getClassLoader(); |
| 23 | + private static final ClassLoader currentClassLoader = |
| 24 | + ExceptionFactoryTest.class.getClassLoader(); |
29 | 25 |
|
30 | 26 | /** loaded by the current classloader */ |
31 | 27 | private static Class<?> opentestComparisonFailure; |
32 | 28 |
|
33 | 29 | private static Class<?> opentestArgumentsAreDifferent; |
34 | 30 |
|
35 | | - /** loaded by the classloader {@value #classLoaderWithoutOpenTest}, which excludes OpenTest4J classes */ |
36 | | - private static Class<?> junit3ComparisonFailure; |
37 | | - |
38 | | - private static Class<?> junit3ArgumentsAreDifferent; |
39 | | - |
40 | 31 | /** loaded by the custom classloader {@value #classLoaderWithoutJUnitOrOpenTest}, which excludes JUnit and OpenTest4J classes */ |
41 | 32 | private static Class<?> nonJunitArgumentsAreDifferent; |
42 | 33 |
|
43 | 34 | @BeforeClass |
44 | 35 | public static void init() throws ClassNotFoundException { |
45 | 36 | nonJunitArgumentsAreDifferent = |
46 | 37 | classLoaderWithoutJUnitOrOpenTest.loadClass(ArgumentsAreDifferent.class.getName()); |
47 | | - junit3ComparisonFailure = |
48 | | - classLoaderWithoutOpenTest.loadClass( |
49 | | - junit.framework.ComparisonFailure.class.getName()); |
50 | | - junit3ArgumentsAreDifferent = |
51 | | - classLoaderWithoutOpenTest.loadClass( |
52 | | - org.mockito.exceptions.verification.junit.ArgumentsAreDifferent.class |
53 | | - .getName()); |
54 | 38 | opentestComparisonFailure = org.opentest4j.AssertionFailedError.class; |
55 | 39 | opentestArgumentsAreDifferent = |
56 | 40 | org.mockito.exceptions.verification.opentest4j.ArgumentsAreDifferent.class; |
@@ -63,15 +47,6 @@ public void createArgumentsAreDifferentException_withoutJUnitOrOpenTest() throws |
63 | 47 | assertThat(e).isExactlyInstanceOf(nonJunitArgumentsAreDifferent); |
64 | 48 | } |
65 | 49 |
|
66 | | - @Test |
67 | | - public void createArgumentsAreDifferentException_withJUnit3_butNotOpenTest() throws Exception { |
68 | | - AssertionError e = invokeFactoryThroughLoader(classLoaderWithoutOpenTest); |
69 | | - |
70 | | - assertThat(e) |
71 | | - .isExactlyInstanceOf(junit3ArgumentsAreDifferent) |
72 | | - .isInstanceOf(junit3ComparisonFailure); |
73 | | - } |
74 | | - |
75 | 50 | @Test |
76 | 51 | public void createArgumentsAreDifferentException_withOpenTest() throws Exception { |
77 | 52 | AssertionError e = invokeFactoryThroughLoader(currentClassLoader); |
@@ -92,17 +67,6 @@ public void createArgumentsAreDifferentException_withoutJUnitOrOpenTest_2x() thr |
92 | 67 | assertThat(e).isExactlyInstanceOf(nonJunitArgumentsAreDifferent); |
93 | 68 | } |
94 | 69 |
|
95 | | - @Test |
96 | | - public void createArgumentsAreDifferentException_withJUnit3_2x() throws Exception { |
97 | | - AssertionError e; |
98 | | - |
99 | | - e = invokeFactoryThroughLoader(classLoaderWithoutOpenTest); |
100 | | - assertThat(e).isExactlyInstanceOf(junit3ArgumentsAreDifferent); |
101 | | - |
102 | | - e = invokeFactoryThroughLoader(classLoaderWithoutOpenTest); |
103 | | - assertThat(e).isExactlyInstanceOf(junit3ArgumentsAreDifferent); |
104 | | - } |
105 | | - |
106 | 70 | @Test |
107 | 71 | public void createArgumentsAreDifferentException_withOpenTest_2x() throws Exception { |
108 | 72 | AssertionError e; |
|