22
22
* SOFTWARE.
23
23
*/
24
24
25
+ import javax .inject .Inject ;
26
+
25
27
import java .util .List ;
26
28
27
29
import org .codehaus .modello .core .ModelloCore ;
31
33
import org .codehaus .modello .model .ModelField ;
32
34
import org .codehaus .modello .model .Version ;
33
35
import org .codehaus .modello .model .VersionRange ;
34
- import org .codehaus .plexus .ContainerConfiguration ;
35
- import org .codehaus .plexus .PlexusConstants ;
36
- import org .codehaus .plexus .PlexusTestCase ;
36
+ import org .codehaus .plexus .testing .PlexusTest ;
37
+ import org .junit .jupiter .api .Test ;
38
+
39
+ import static org .codehaus .plexus .testing .PlexusExtension .getTestFile ;
40
+ import static org .junit .jupiter .api .Assertions .*;
37
41
38
42
/**
39
43
* @author <a href="mailto:[email protected] ">Trygve Laugstøl</a>
40
44
* @author <a href="mailto:[email protected] ">Emmanuel Venisse</a>
41
45
*/
42
- public class ModelReaderTest extends PlexusTestCase {
43
- public void testBasic () throws Exception {
44
- ModelloCore modello = (ModelloCore ) lookup (ModelloCore .ROLE );
46
+ @ PlexusTest
47
+ class ModelReaderTest {
48
+
49
+ @ Inject
50
+ ModelloCore modello ;
45
51
52
+ @ Test
53
+ void basic () throws Exception {
46
54
Model model = modello .loadModel (getTestFile ("src/test/resources/models/simple.mdo" ));
47
55
48
56
assertNotNull (model );
@@ -73,14 +81,13 @@ public void testBasic() throws Exception {
73
81
assertGirl (model .getClass ("Girl" , new VersionRange ("1.0.0" )));
74
82
}
75
83
76
- public void testAssociationDefaultValues () throws Exception {
77
- ModelloCore modello = (ModelloCore ) lookup (ModelloCore .ROLE );
78
-
84
+ @ Test
85
+ void associationDefaultValues () throws Exception {
79
86
Model model = modello .loadModel (getTestFile ("src/test/resources/models/association.mdo" ));
80
87
81
88
ModelField field = model .getClass ("Foo" , new VersionRange ("1.0.0" )).getField ("bars" , new VersionRange ("1.0.0" ));
82
89
83
- assertTrue ( field instanceof ModelAssociation );
90
+ assertInstanceOf ( ModelAssociation . class , field );
84
91
85
92
ModelAssociation association = (ModelAssociation ) field ;
86
93
@@ -102,7 +109,7 @@ public void testAssociationDefaultValues() throws Exception {
102
109
}
103
110
104
111
private void assertBoy (Object boyObject ) {
105
- assertTrue ( boyObject instanceof ModelClass );
112
+ assertInstanceOf ( ModelClass . class , boyObject );
106
113
107
114
ModelClass boy = (ModelClass ) boyObject ;
108
115
@@ -122,7 +129,7 @@ private void assertBoy(Object boyObject) {
122
129
}
123
130
124
131
private void assertBoyName (Object nameObject ) {
125
- assertTrue ( nameObject instanceof ModelField );
132
+ assertInstanceOf ( ModelField . class , nameObject );
126
133
127
134
ModelField name = (ModelField ) nameObject ;
128
135
@@ -136,7 +143,7 @@ private void assertBoyName(Object nameObject) {
136
143
}
137
144
138
145
private void assertGirl (Object girlObject ) {
139
- assertTrue ( girlObject instanceof ModelClass );
146
+ assertInstanceOf ( ModelClass . class , girlObject );
140
147
141
148
ModelClass girl = (ModelClass ) girlObject ;
142
149
@@ -156,7 +163,7 @@ private void assertGirl(Object girlObject) {
156
163
}
157
164
158
165
private void assertGirlAge (Object ageObject ) {
159
- assertTrue ( ageObject instanceof ModelField );
166
+ assertInstanceOf ( ModelField . class , ageObject );
160
167
161
168
ModelField age = (ModelField ) ageObject ;
162
169
@@ -166,10 +173,4 @@ private void assertGirlAge(Object ageObject) {
166
173
167
174
assertEquals ("int" , age .getType ());
168
175
}
169
-
170
- @ Override
171
- protected void customizeContainerConfiguration (ContainerConfiguration configuration ) {
172
- configuration .setAutoWiring (true );
173
- configuration .setClassPathScanning (PlexusConstants .SCANNING_INDEX );
174
- }
175
176
}
0 commit comments