View Javadoc
1   /*
2    * MIT License
3    * Copyright (c) 2006-2025 JMockit developers
4    * See LICENSE file for full license text.
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   * The Class StandardDI2Test.
20   */
21  @ExtendWith(JMockitExtension.class)
22  class StandardDI2Test {
23  
24      /**
25       * The Class TestedClass.
26       */
27      static class TestedClass {
28  
29          /**
30           * Instantiates a new tested class.
31           */
32          TestedClass() {
33              throw new RuntimeException("Must not occur");
34          }
35  
36          /**
37           * Instantiates a new tested class.
38           *
39           * @param action
40           *            the action
41           */
42          @Inject
43          TestedClass(Runnable action) {
44          }
45      }
46  
47      /** The tested. */
48      @Tested
49      TestedClass tested;
50  
51      /**
52       * Attempt to create tested object through annotated constructor with missing injectables.
53       */
54      @Test
55      @ExpectedException(IllegalArgumentException.class)
56      public void attemptToCreateTestedObjectThroughAnnotatedConstructorWithMissingInjectables() {
57          fail();
58      }
59  }