@@ -63,7 +63,7 @@ private WebAssert() {
63
63
*/
64
64
public static void assertTitleEquals (final HtmlPage page , final String title ) {
65
65
final String s = page .getTitleText ();
66
- if (!s .equals (title )) {
66
+ if (!title .equals (s )) {
67
67
final String msg = "Actual page title '" + s + "' does not match expected page title '" + title + "'." ;
68
68
throw new AssertionError (msg );
69
69
}
@@ -157,7 +157,7 @@ public static void assertElementNotPresent(final HtmlPage page, final String id)
157
157
catch (final ElementNotFoundException e ) {
158
158
return ;
159
159
}
160
- final String msg = "The page contains an element with ID '" + id + "'." ;
160
+ final String msg = "The page contains an element with ID '" + id + "' but should not ." ;
161
161
throw new AssertionError (msg );
162
162
}
163
163
@@ -173,7 +173,8 @@ public static void assertElementNotPresentByXPath(final HtmlPage page, final Str
173
173
final List <?> elements = page .getByXPath (xpath );
174
174
if (!elements .isEmpty ()) {
175
175
final String msg = "The page contains " + elements .size ()
176
- + " element(s) matching the XPath expression '" + xpath + "'." ;
176
+ + " element(s) matching the XPath expression '"
177
+ + xpath + "' but should not contain any." ;
177
178
throw new AssertionError (msg );
178
179
}
179
180
}
@@ -229,7 +230,7 @@ public static void assertTextPresentInElement(final HtmlPage page, final String
229
230
*/
230
231
public static void assertTextNotPresent (final HtmlPage page , final String text ) {
231
232
if (page .asNormalizedText ().contains (text )) {
232
- final String msg = "The page contains the text '" + text + "'." ;
233
+ final String msg = "The page contains the text '" + text + "' but should not ." ;
233
234
throw new AssertionError (msg );
234
235
}
235
236
}
@@ -246,7 +247,7 @@ public static void assertTextNotPresentInElement(final HtmlPage page, final Stri
246
247
try {
247
248
final HtmlElement element = page .getHtmlElementById (id );
248
249
if (element .asNormalizedText ().contains (text )) {
249
- final String msg = "The element with ID '" + id + "' contains the text '" + text + "'." ;
250
+ final String msg = "The element with ID '" + id + "' contains the text '" + text + "' but should not ." ;
250
251
throw new AssertionError (msg );
251
252
}
252
253
}
@@ -289,7 +290,7 @@ public static void assertLinkNotPresent(final HtmlPage page, final String id) {
289
290
try {
290
291
page .getDocumentElement ().getOneHtmlElementByAttribute ("a" , DomElement .ID_ATTRIBUTE , id );
291
292
// Not expected.
292
- final String msg = "The page contains a link with ID '" + id + "'." ;
293
+ final String msg = "The page contains a link with ID '" + id + "' but should not ." ;
293
294
throw new AssertionError (msg );
294
295
}
295
296
catch (final ElementNotFoundException expected ) {
@@ -333,7 +334,7 @@ public static void assertLinkNotPresentWithText(final HtmlPage page, final Strin
333
334
}
334
335
}
335
336
if (found ) {
336
- final String msg = "The page contains a link with text '" + text + "'." ;
337
+ final String msg = "The page contains a link with text '" + text + "' but should not ." ;
337
338
throw new AssertionError (msg );
338
339
}
339
340
}
@@ -371,7 +372,7 @@ public static void assertFormNotPresent(final HtmlPage page, final String name)
371
372
catch (final ElementNotFoundException e ) {
372
373
return ;
373
374
}
374
- final String msg = "The page contains a form named '" + name + "'." ;
375
+ final String msg = "The page contains a form named '" + name + "' but should not ." ;
375
376
throw new AssertionError (msg );
376
377
}
377
378
0 commit comments