1
2
3
4
5
6 package mockit.integration.junit4;
7
8 import static org.junit.jupiter.api.Assertions.assertEquals;
9
10 import mockit.Mock;
11 import mockit.MockUp;
12
13 import org.junit.BeforeClass;
14 import org.junit.Test;
15
16 public final class SecondJUnit4DecoratorTest {
17 public static final class RealClass3 {
18 public String getValue() {
19 return "REAL3";
20 }
21 }
22
23 public static final class FakeClass3 extends MockUp<RealClass3> {
24 @Mock
25 public String getValue() {
26 return "TEST3";
27 }
28 }
29
30 @BeforeClass
31 public static void setUpFakes() {
32 new FakeClass3();
33 }
34
35 @Test
36 public void realClassesFakedInPreviousTestClassMustNoLongerBeFaked() {
37 assertEquals("REAL0", new BaseJUnit4DecoratorTest.RealClass0().getValue());
38 assertEquals("REAL1", new BaseJUnit4DecoratorTest.RealClass1().getValue());
39 assertEquals("REAL2", new JUnit4DecoratorTest.RealClass2().getValue());
40 }
41
42 @Test
43 public void useClassScopedFakeDefinedForThisClass() {
44 assertEquals("TEST3", new RealClass3().getValue());
45 }
46 }