File tree Expand file tree Collapse file tree 4 files changed +68
-0
lines changed
src/test/java/org/codehaus/plexus/testing Expand file tree Collapse file tree 4 files changed +68
-0
lines changed Original file line number Diff line number Diff line change 6262 <artifactId >guice</artifactId >
6363 <version >6.0.0</version >
6464 </dependency >
65+ <dependency >
66+ <groupId >jakarta.annotation</groupId >
67+ <artifactId >jakarta.annotation-api</artifactId >
68+ <version >2.1.1</version >
69+ <scope >provided</scope >
70+ <optional >true</optional >
71+ </dependency >
72+
6573 <dependency >
6674 <groupId >org.junit.jupiter</groupId >
6775 <artifactId >junit-jupiter-api</artifactId >
Original file line number Diff line number Diff line change 2323import org .junit .jupiter .api .Test ;
2424
2525import static org .junit .jupiter .api .Assertions .assertNotNull ;
26+ import static org .junit .jupiter .api .Assertions .assertNull ;
2627
2728@ PlexusTest
2829class PlexusTestJakartaTest {
@@ -34,6 +35,12 @@ class PlexusTestJakartaTest {
3435 void dependencyShouldBeInjected () {
3536 assertNotNull (testJakartaComponent );
3637 assertNotNull (testJakartaComponent .getTestJakartaComponent2 ());
38+ assertNotNull (testJakartaComponent .getTestJakartaComponent3Named ());
39+ assertNull (testJakartaComponent .getTestJakartaComponent3NullableJavax ());
40+ assertNull (testJakartaComponent .getTestJakartaComponent3NullableJakarta ());
41+
42+ assertNotNull (testJakartaComponent .getTestJavaxComponent2 ());
43+ assertNotNull (testJakartaComponent .getTestJavaxComponent2 ());
3744 assertNotNull (testJakartaComponent .getTestJavaxComponent2 ());
3845 }
3946}
Original file line number Diff line number Diff line change 1919 * under the License.
2020 */
2121
22+ import jakarta .annotation .Nonnull ;
2223import jakarta .inject .Inject ;
2324import jakarta .inject .Named ;
2425
@@ -30,11 +31,38 @@ public class TestJakartaComponent {
3031 @ Inject
3132 private TestJakartaComponent2 testJakartaComponent2 ;
3233
34+ @ Inject
35+ @ Nonnull
36+ @ Named ("someComponent" )
37+ private TestJakartaComponent3 testJakartaComponent3Named ;
38+
39+ @ Inject
40+ @ javax .annotation .Nullable
41+ @ Named ("someComponentNotExisting" )
42+ private TestJakartaComponent3 testJakartaComponent3NullableJavax ;
43+
44+ @ Inject
45+ @ jakarta .annotation .Nullable
46+ @ Named ("someComponentNotExisting" )
47+ private TestJakartaComponent3 testJakartaComponent3NullableJakarta ;
48+
3349 public TestJavaxComponent2 getTestJavaxComponent2 () {
3450 return testJavaxComponent2 ;
3551 }
3652
3753 public TestJakartaComponent2 getTestJakartaComponent2 () {
3854 return testJakartaComponent2 ;
3955 }
56+
57+ public TestJakartaComponent3 getTestJakartaComponent3Named () {
58+ return testJakartaComponent3Named ;
59+ }
60+
61+ public TestJakartaComponent3 getTestJakartaComponent3NullableJavax () {
62+ return testJakartaComponent3NullableJavax ;
63+ }
64+
65+ public TestJakartaComponent3 getTestJakartaComponent3NullableJakarta () {
66+ return testJakartaComponent3NullableJakarta ;
67+ }
4068}
Original file line number Diff line number Diff line change 1+ package org .codehaus .plexus .testing ;
2+
3+ /*
4+ * Licensed to the Apache Software Foundation (ASF) under one
5+ * or more contributor license agreements. See the NOTICE file
6+ * distributed with this work for additional information
7+ * regarding copyright ownership. The ASF licenses this file
8+ * to you under the Apache License, Version 2.0 (the
9+ * "License"); you may not use this file except in compliance
10+ * with the License. You may obtain a copy of the License at
11+ *
12+ * http://www.apache.org/licenses/LICENSE-2.0
13+ *
14+ * Unless required by applicable law or agreed to in writing,
15+ * software distributed under the License is distributed on an
16+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+ * KIND, either express or implied. See the License for the
18+ * specific language governing permissions and limitations
19+ * under the License.
20+ */
21+
22+ import javax .inject .Named ;
23+
24+ @ Named ("someComponent" )
25+ public class TestJakartaComponent3 {}
You can’t perform that action at this time.
0 commit comments