1
2
3
4
5
6 package mockit;
7
8 import static org.junit.jupiter.api.Assertions.assertSame;
9
10 import mockit.integration.junit5.JMockitExtension;
11
12 import org.junit.jupiter.api.Test;
13 import org.junit.jupiter.api.extension.ExtendWith;
14
15 class BaseTestClass {
16 static final class Dependency {
17 }
18
19 @Tested
20 final Dependency dependency = new Dependency();
21 }
22
23
24
25
26 @ExtendWith(JMockitExtension.class)
27 class TestedClassInjectedFromBaseTest extends BaseTestClass {
28
29
30
31
32 static final class TestedClass {
33
34 Dependency dependency;
35 }
36
37
38 @Tested(fullyInitialized = true)
39 TestedClass tested;
40
41
42
43
44 @Test
45 void verifyTestedObjectInjectedWithTestedDependencyProvidedByBaseTestClass() {
46 assertSame(dependency, tested.dependency);
47 }
48 }