1
2
3
4
5
6 package mockit;
7
8 import static org.junit.jupiter.api.Assertions.fail;
9
10 import jakarta.inject.Inject;
11
12 import mockit.integration.junit5.ExpectedException;
13 import mockit.integration.junit5.JMockitExtension;
14
15 import org.junit.jupiter.api.Test;
16 import org.junit.jupiter.api.extension.ExtendWith;
17
18
19
20
21 @ExtendWith(JMockitExtension.class)
22 class StandardDI2Test {
23
24
25
26
27 static class TestedClass {
28
29
30
31
32 TestedClass() {
33 throw new RuntimeException("Must not occur");
34 }
35
36
37
38
39
40
41
42 @Inject
43 TestedClass(Runnable action) {
44 }
45 }
46
47
48 @Tested
49 TestedClass tested;
50
51
52
53
54 @Test
55 @ExpectedException(IllegalArgumentException.class)
56 public void attemptToCreateTestedObjectThroughAnnotatedConstructorWithMissingInjectables() {
57 fail();
58 }
59 }