23
23
import org .codehaus .plexus .util .xml .pull .MXParser ;
24
24
import org .codehaus .plexus .util .xml .pull .XmlPullParser ;
25
25
import org .codehaus .plexus .util .xml .pull .XmlPullParserException ;
26
- import org .junit .Test ;
26
+ import org .junit .jupiter . api . Test ;
27
27
28
- import static org .junit .Assert .assertEquals ;
29
- import static org .junit .Assert .assertFalse ;
30
- import static org .junit .Assert .assertTrue ;
28
+ import static org .junit .jupiter .api .Assertions .*;
31
29
32
30
/**
33
31
* Test the Xpp3DomBuilder.
@@ -52,7 +50,7 @@ public void testBuildFromReader() throws Exception {
52
50
53
51
Xpp3Dom expectedDom = createExpectedDom ();
54
52
55
- assertEquals ("check DOMs match" , expectedDom , dom );
53
+ assertEquals (expectedDom , dom , "check DOMs match" );
56
54
}
57
55
58
56
/**
@@ -66,12 +64,11 @@ public void testBuildTrimming() throws Exception {
66
64
67
65
Xpp3Dom dom = Xpp3DomBuilder .build (new StringReader (domString ), true );
68
66
69
- assertEquals ("test with trimming on" , " element1" , dom .getChild ("el1" ).getValue ());
67
+ assertEquals ("element1" , dom .getChild ("el1" ).getValue (), "test with trimming on" );
70
68
71
69
dom = Xpp3DomBuilder .build (new StringReader (domString ), false );
72
70
73
- assertEquals (
74
- "test with trimming off" , " element1\n " , dom .getChild ("el1" ).getValue ());
71
+ assertEquals (" element1\n " , dom .getChild ("el1" ).getValue (), "test with trimming off" );
75
72
}
76
73
77
74
/**
@@ -116,10 +113,10 @@ public void testBuildFromXpp3Dom() throws Exception {
116
113
eventType = parser .next ();
117
114
}
118
115
119
- assertEquals ("Check DOM matches" , expectedDom , dom );
120
- assertFalse ("Check closing root was consumed" , rootClosed );
121
- assertTrue ("Check continued to parse configuration" , configurationClosed );
122
- assertTrue ("Check continued to parse newRoot" , newRootClosed );
116
+ assertEquals (expectedDom , dom , "Check DOM matches" );
117
+ assertFalse (rootClosed , "Check closing root was consumed" );
118
+ assertTrue (configurationClosed , "Check continued to parse configuration" );
119
+ assertTrue (newRootClosed , "Check continued to parse newRoot" );
123
120
}
124
121
125
122
/**
@@ -149,15 +146,13 @@ public void testUnclosedXml() {
149
146
public void testEscapingInContent () throws IOException , XmlPullParserException {
150
147
Xpp3Dom dom = Xpp3DomBuilder .build (new StringReader (getEncodedString ()));
151
148
152
- assertEquals ("Check content value" , "\" text\" " , dom .getChild ("el" ).getValue ());
153
- assertEquals (
154
- "Check content value" , "<b>\" text\" </b>" , dom .getChild ("ela" ).getValue ());
155
- assertEquals (
156
- "Check content value" , "<b>\" text\" </b>" , dom .getChild ("elb" ).getValue ());
149
+ assertEquals ("\" text\" " , dom .getChild ("el" ).getValue (), "Check content value" );
150
+ assertEquals ("<b>\" text\" </b>" , dom .getChild ("ela" ).getValue (), "Check content value" );
151
+ assertEquals ("<b>\" text\" </b>" , dom .getChild ("elb" ).getValue (), "Check content value" );
157
152
158
153
StringWriter w = new StringWriter ();
159
154
Xpp3DomWriter .write (w , dom );
160
- assertEquals ("Compare stringified DOMs" , getExpectedString (), w .toString ());
155
+ assertEquals (getExpectedString (), w .toString (), "Compare stringified DOMs" );
161
156
}
162
157
163
158
/**
@@ -171,12 +166,12 @@ public void testEscapingInAttributes() throws IOException, XmlPullParserExceptio
171
166
String s = getAttributeEncodedString ();
172
167
Xpp3Dom dom = Xpp3DomBuilder .build (new StringReader (s ));
173
168
174
- assertEquals ("Check attribute value" , " <foo>" , dom .getChild ("el" ).getAttribute ("att" ));
169
+ assertEquals ("<foo>" , dom .getChild ("el" ).getAttribute ("att" ), "Check attribute value" );
175
170
176
171
StringWriter w = new StringWriter ();
177
172
Xpp3DomWriter .write (w , dom );
178
173
String newString = w .toString ();
179
- assertEquals ("Compare stringified DOMs" , newString , s );
174
+ assertEquals (newString , s , "Compare stringified DOMs" );
180
175
}
181
176
182
177
/**
@@ -194,16 +189,16 @@ public Object toInputLocation(XmlPullParser parser) {
194
189
};
195
190
Xpp3Dom dom = Xpp3DomBuilder .build (new StringReader (createDomString ()), true , ilb );
196
191
Xpp3Dom expectedDom = createExpectedDom ();
197
- assertEquals ("root input location" , expectedDom .getInputLocation (), dom .getInputLocation ());
192
+ assertEquals (expectedDom .getInputLocation (), dom .getInputLocation (), "root input location" );
198
193
for (int i = 0 ; i < dom .getChildCount (); i ++) {
199
194
Xpp3Dom elt = dom .getChild (i );
200
195
Xpp3Dom expectedElt = expectedDom .getChild (i );
201
- assertEquals (elt . getName () + " input location" , expectedElt .getInputLocation (), elt .getInputLocation () );
196
+ assertEquals (expectedElt . getInputLocation (), elt .getInputLocation (), elt .getName () + " input location" );
202
197
203
198
if ("el2" .equals (elt .getName ())) {
204
199
Xpp3Dom el3 = elt .getChild (0 );
205
200
Xpp3Dom expectedEl3 = expectedElt .getChild (0 );
206
- assertEquals (el3 . getName () + " input location" , expectedEl3 .getInputLocation (), el3 .getInputLocation () );
201
+ assertEquals (expectedEl3 . getInputLocation (), el3 .getInputLocation (), el3 .getName () + " input location" );
207
202
}
208
203
}
209
204
}
0 commit comments