Skip to content

Commit 4f8849c

Browse files
authored
fix usage of asserts where order or condition is missleading (#1700)
* fix usage of asserts where order or condition is missleading
1 parent e293b05 commit 4f8849c

File tree

19 files changed

+282
-303
lines changed

19 files changed

+282
-303
lines changed

org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/templates/TemplateCompletionTests.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
package org.eclipse.jdt.text.tests.templates;
1414

1515
import static org.junit.Assert.assertEquals;
16+
import static org.junit.Assert.assertFalse;
1617
import static org.junit.Assert.assertTrue;
17-
import static org.junit.Assert.fail;
1818

1919
import java.util.Arrays;
2020
import java.util.List;
@@ -102,9 +102,7 @@ public void testExepectNoProposals() throws Exception {
102102
List<ICompletionProposal> proposals= computeCompletionProposals(cu, completionIndex);
103103

104104
boolean fail= proposals.stream().anyMatch(p -> "new_class - create new class".equals(p.getDisplayString()));
105-
if (fail) {
106-
fail("Proposal '" + propDisplay + "' should not exist");
107-
}
105+
assertFalse("Proposal '" + propDisplay + "' should not exist", fail);
108106
}
109107

110108
@Test

org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractConstantTests1d7.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
*******************************************************************************/
1414
package org.eclipse.jdt.ui.tests.refactoring;
1515

16+
import static org.junit.Assert.assertEquals;
1617
import static org.junit.Assert.assertNotNull;
17-
import static org.junit.Assert.assertTrue;
1818

1919
import org.junit.Test;
2020
import org.junit.runner.RunWith;
@@ -62,7 +62,7 @@ private void failHelper2(int startLine, int startColumn, int endLine, int endCol
6262

6363
assertNotNull("precondition was supposed to fail", result);
6464
if(checkMsg)
65-
assertTrue(errorMsg.equals(result.getEntryMatchingSeverity(RefactoringStatus.FATAL).getMessage()));
65+
assertEquals(errorMsg, result.getEntryMatchingSeverity(RefactoringStatus.FATAL).getMessage());
6666
}
6767
//--- TESTS
6868

org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/IntroduceFactoryTestsBase.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package org.eclipse.jdt.ui.tests.refactoring;
1616

1717
import static org.junit.Assert.assertEquals;
18+
import static org.junit.Assert.assertFalse;
1819
import static org.junit.Assert.assertNotNull;
1920
import static org.junit.Assert.assertTrue;
2021
import static org.junit.Assert.fail;
@@ -164,10 +165,8 @@ private ISourceRange findSelectionInSource(String source) throws Exception {
164165
int begin= source.indexOf(SELECTION_START_HERALD) + SELECTION_START_HERALD.length();
165166
int end= source.indexOf(SELECTION_END_HERALD);
166167

167-
if (begin < SELECTION_START_HERALD.length())
168-
fail("No selection start comment in input source file!");
169-
if (end < 0)
170-
fail("No selection end comment in input source file!");
168+
assertFalse("No selection start comment in input source file!", begin < SELECTION_START_HERALD.length());
169+
assertFalse("No selection end comment in input source file!", end < 0);
171170

172171
return new SourceRange(begin, end-begin);
173172
}

org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/MakeStaticRefactoringTests.java

Lines changed: 25 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
package org.eclipse.jdt.ui.tests.refactoring;
1414

15+
import static org.junit.Assert.assertEquals;
1516
import static org.junit.Assert.assertFalse;
1617
import static org.junit.Assert.assertTrue;
1718

@@ -154,14 +155,14 @@ public void testArrayParameterAndReturnType() throws Exception {
154155
public void testMethodNotFound() throws Exception {
155156
//Method cannot be found
156157
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.Foo" }, 2, 0, 2, 1);
157-
assertTrue(status.getEntryWithHighestSeverity().getMessage().equals(RefactoringCoreMessages.MakeStaticRefactoring_not_available_on_this_selection));
158+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_not_available_on_this_selection);
158159
}
159160

160161
@Test
161162
public void testIsConstructor() throws Exception {
162163
//Check if Constructor
163164
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.Foo" }, 2, 12, 2, 15);
164-
assertTrue(status.getEntryWithHighestSeverity().getMessage().equals(RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_constructors));
165+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_constructors);
165166
}
166167

167168
@Test
@@ -197,61 +198,57 @@ public void testMultipleFilesInSameProject() throws Exception {
197198
public void testRecursive() throws Exception {
198199
//MethodInvocation in MethodDeclaration with object of the same Class in parameter
199200
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.Foo" }, 3, 10, 3, 13);
200-
assertTrue(status.getEntryWithHighestSeverity().getMessage()
201-
.equals(RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_recursive_methods));
201+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_recursive_methods);
202202
}
203203

204204
@Test
205205
public void testRecursive2() throws Exception {
206206
//recursive invocation after invoking a method that returns a new instance of the same class
207207
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.Foo" }, 6, 10, 6, 13);
208-
assertTrue(status.getEntryWithHighestSeverity().getMessage()
209-
.equals(RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_recursive_methods));
208+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_recursive_methods);
210209
}
211210

212211
@Test
213212
public void testRecursive3() throws Exception {
214213
//simple recursive invocation of instance method
215214
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.Foo" }, 2, 17, 2, 20);
216-
assertTrue(status.getEntryWithHighestSeverity().getMessage()
217-
.equals(RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_recursive_methods));
215+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_recursive_methods);
218216
}
219217

220218
@Test
221219
public void testInheritance() throws Exception {
222220
//Refactor of method that overrides method of supertype (Selection is set to MethodDeclaration)
223221
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.SubClass", "p.SuperClass" }, 4, 19, 4, 22);
224-
assertTrue(status.getEntryWithHighestSeverity().getMessage()
225-
.equals(RefactoringCoreMessages.MakeStaticRefactoring_explicit_super_method_invocation));
222+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_explicit_super_method_invocation);
226223
}
227224

228225
@Test
229226
public void testInheritance2() throws Exception {
230227
//Refactor of method in super type that has child type overriding the method -> should fail
231228
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.SuperClass", "p.SubClass" }, 3, 19, 3, 22);
232-
assertTrue(status.getEntryWithHighestSeverity().getMessage().equals(RefactoringCoreMessages.MakeStaticRefactoring_method_is_overridden_in_subtype));
229+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_method_is_overridden_in_subtype);
233230
}
234231

235232
@Test
236233
public void testInheritance3() throws Exception {
237234
//Selecting SuperMethodInvocation -> should fail
238235
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.SubClass", "p.SuperClass" }, 5, 26, 5, 29);
239-
assertTrue(status.getEntryWithHighestSeverity().getMessage().equals(RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_super_method_invocations));
236+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_super_method_invocations);
240237
}
241238

242239
@Test
243240
public void testInheritance4() throws Exception {
244241
//Refactor method without parameters on the lowest hierarchy level ->
245242
//After refactoring it is static but has the same signature as parent type method -> should fail
246243
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.SubClass", "p.SuperClass" }, 4, 19, 4, 22);
247-
assertTrue(status.getEntryWithHighestSeverity().getMessage().equals(RefactoringCoreMessages.MakeStaticRefactoring_hiding_method_of_parent_type));
244+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_hiding_method_of_parent_type);
248245
}
249246

250247
@Test
251248
public void testInheritance5() throws Exception {
252249
//Inheritance with Recursion
253250
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.SubClass", "p.SuperClass" }, 4, 10, 4, 13);
254-
assertTrue(status.getEntryWithHighestSeverity().getMessage().equals(RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_recursive_methods));
251+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_recursive_methods);
255252
}
256253

257254
@Test
@@ -265,8 +262,7 @@ public void testDuplicateParamName() throws Exception {
265262
public void testDuplicateMethod() throws Exception {
266263
//Selected method has instance usage and there is an existing method that is equal to the selected method after being refactored
267264
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.Foo" }, 5, 19, 5, 22);
268-
assertTrue(status.getEntryWithHighestSeverity().getMessage()
269-
.equals(RefactoringCoreMessages.MakeStaticRefactoring_duplicate_method_signature));
265+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_duplicate_method_signature);
270266
}
271267

272268
@Test
@@ -280,8 +276,7 @@ public void testDuplicateMethod2() throws Exception {
280276
public void testMethodAlreadyStatic() throws Exception {
281277
//Selected method is already static
282278
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.Foo" }, 2, 24, 2, 27);
283-
assertTrue(status.getEntryWithHighestSeverity().getMessage()
284-
.equals(RefactoringCoreMessages.MakeStaticRefactoring_method_already_static));
279+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_method_already_static);
285280
}
286281

287282
@Test
@@ -353,16 +348,14 @@ public void testGenericDeclaration8() throws Exception {
353348
public void testGenericDeclaration9() throws Exception {
354349
//check for wildcardTypes as bounds (T extends List<?>)
355350
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.Foo" }, 7, 17, 7, 20);
356-
assertTrue(status.getEntryWithHighestSeverity().getMessage()
357-
.equals(RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_wildCardTypes_as_bound));
351+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_wildCardTypes_as_bound);
358352
}
359353

360354
@Test
361355
public void testGenericDeclaration10() throws Exception {
362356
//check for wildcardTypes as bounds (T extends Map<? extends Runnable, ? extends Throwable>)
363357
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.Foo" }, 7, 17, 7, 20);
364-
assertTrue(status.getEntryWithHighestSeverity().getMessage()
365-
.equals(RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_wildCardTypes_as_bound));
358+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_wildCardTypes_as_bound);
366359
}
367360

368361
@Test
@@ -419,8 +412,7 @@ public void testMethodCallInNestedAnonymousClass() throws Exception {
419412
public void testVariousInstanceCases() throws Exception {
420413
//Various cases of instance access in many different forms
421414
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.SubClass", "p.SuperClass" }, 14, 17, 14, 20);
422-
assertTrue(status.getEntryWithHighestSeverity().getMessage()
423-
.equals(RefactoringCoreMessages.MakeStaticRefactoring_selected_method_uses_super_field_access));
415+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_selected_method_uses_super_field_access);
424416
}
425417

426418
@Test
@@ -455,8 +447,7 @@ public void testPassingInstanceReference() throws Exception {
455447
public void testSuperMethodReference() throws Exception {
456448
//Selected method is used in SuperMethodReference -> Should throw error
457449
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.SuperClass", "p.SubClass" }, 4, 19, 4, 22);
458-
assertTrue(status.getEntryWithHighestSeverity().getMessage()
459-
.equals(RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_method_references));
450+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_method_references);
460451
}
461452

462453
@Test
@@ -477,8 +468,7 @@ public void testReturnField() throws Exception {
477468
public void testExplicitSuperMethodInvocation() throws Exception {
478469
//MethodDeclaration uses explcit SuperMethodInvocation to call method of parent type -> semantic change not allowed
479470
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.SubClass", "p.SuperClass" }, 3, 17, 3, 20);
480-
assertTrue(status.getEntryWithHighestSeverity().getMessage()
481-
.equals(RefactoringCoreMessages.MakeStaticRefactoring_explicit_super_method_invocation));
471+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_explicit_super_method_invocation);
482472
}
483473

484474
@Test
@@ -492,8 +482,7 @@ public void testImplicitSuperMethodInvocation() throws Exception {
492482
public void testSuperFieldAccess() throws Exception {
493483
//MethodDeclaration uses SuperFieldAccess -> throws warning but is possible
494484
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.SubClass", "p.SuperClass" }, 6, 17, 6, 20);
495-
assertTrue(status.getEntryWithHighestSeverity().getMessage()
496-
.equals(RefactoringCoreMessages.MakeStaticRefactoring_selected_method_uses_super_field_access));
485+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_selected_method_uses_super_field_access);
497486
}
498487

499488
@Test
@@ -505,8 +494,7 @@ public void testConcatenatedFieldAccessAndQualifiedNames() throws Exception {
505494
@Test
506495
public void testSourceNotAvailable() throws Exception {
507496
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.Foo" }, 3, 20, 3, 27);
508-
assertTrue(status.getEntryWithHighestSeverity().getMessage()
509-
.equals(RefactoringCoreMessages.MakeStaticRefactoring_source_not_available_for_selected_method));
497+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_source_not_available_for_selected_method);
510498
}
511499

512500
@Test
@@ -527,8 +515,7 @@ public void testClassInstanceCreation() throws Exception {
527515
public void testConvertMethodReferenceToLambda() throws Exception {
528516
//MethodReference needs to be co0nverted to lambda because refactored method accepts two parameters
529517
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.Foo" }, 10, 10, 10, 13);
530-
assertTrue(status.getEntryWithHighestSeverity().getMessage()
531-
.equals(RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_method_references));
518+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_method_references);
532519
}
533520

534521
@Test
@@ -541,32 +528,28 @@ public void testNested() throws Exception {
541528
public void testMethodReference() throws Exception {
542529
//TypeMethodReference
543530
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.Foo" }, 8, 10, 8, 13);
544-
assertTrue(status.getEntryWithHighestSeverity().getMessage()
545-
.equals(RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_method_references));
531+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_method_references);
546532
}
547533

548534
@Test
549535
public void testMethodReference2() throws Exception {
550536
//ExpressionMethodReference in anonymous class -> Refactoring not allowed in anonymous class and method references also not allowed
551537
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.Foo" }, 4, 26, 4, 29);
552-
assertTrue(status.getEntryWithHighestSeverity().getMessage()
553-
.equals(RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_local_or_anonymous_types));
538+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_local_or_anonymous_types);
554539
}
555540

556541
@Test
557542
public void testMethodReference3() throws Exception {
558543
//ExpressionMethodReference with recursion
559544
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.Foo" }, 2, 17, 2, 20);
560-
assertTrue(status.getEntryWithHighestSeverity().getMessage()
561-
.equals(RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_recursive_methods));
545+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_recursive_methods);
562546
}
563547

564548
@Test
565549
public void testMethodReference4() throws Exception {
566550
//ExpressionMethodReference
567551
RefactoringStatus status= performRefactoringAndMatchFiles(new String[] { "p.Foo" }, 8, 17, 8, 20);
568-
assertTrue(status.getEntryWithHighestSeverity().getMessage()
569-
.equals(RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_method_references));
552+
assertEquals(status.getEntryWithHighestSeverity().getMessage(), RefactoringCoreMessages.MakeStaticRefactoring_not_available_for_method_references);
570553
}
571554

572555
@Test

org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/junit/tests/WrappingSystemTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
package org.eclipse.jdt.junit.tests;
1515

1616
import static org.junit.Assert.assertEquals;
17+
import static org.junit.Assert.assertFalse;
1718
import static org.junit.Assert.assertNull;
1819
import static org.junit.Assert.assertTrue;
19-
import static org.junit.Assert.fail;
2020

2121
import java.util.Iterator;
2222
import java.util.List;
@@ -213,10 +213,9 @@ protected void waitForTableToFill(int numExpectedTableLines,
213213
int millisecondTimeout, boolean lastItemHasImage) throws PartInitException {
214214
long startTime = System.currentTimeMillis();
215215
while (stillWaiting(numExpectedTableLines, lastItemHasImage)) {
216-
if (System.currentTimeMillis() - startTime > millisecondTimeout)
217-
fail("Timeout waiting for " + numExpectedTableLines
218-
+ " lines in table. Present: " + getNumTableItems() + " items.\n"
219-
+ "The 2nd vm has " + (hasNotTerminated() ? "not " : "") + "terminated.");
216+
assertFalse("Timeout waiting for " + numExpectedTableLines
217+
+ " lines in table. Present: " + getNumTableItems() + " items.\n"
218+
+ "The 2nd vm has " + (hasNotTerminated() ? "not " : "") + "terminated.", System.currentTimeMillis() - startTime > millisecondTimeout);
220219
dispatchEvents();
221220
}
222221
}

org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/core/TypeInfoTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import static org.junit.Assert.assertEquals;
1717
import static org.junit.Assert.assertNotEquals;
1818
import static org.junit.Assert.assertNotNull;
19+
import static org.junit.Assert.assertNull;
1920
import static org.junit.Assert.assertTrue;
2021
import static org.junit.Assert.fail;
2122

@@ -297,7 +298,7 @@ public void testBug578547() {
297298

298299
filter= new TypeInfoFilter("Test", scope, 0, null);
299300
assertEquals("Test", filter.getNamePattern());
300-
assertEquals(null, filter.getPackagePattern());
301+
assertNull(filter.getPackagePattern());
301302
}
302303

303304
}

org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/hover/JavadocHoverTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
package org.eclipse.jdt.ui.tests.hover;
1616

1717
import static org.junit.Assert.assertEquals;
18-
import static org.junit.Assert.assertFalse;
18+
import static org.junit.Assert.assertNotEquals;
1919
import static org.junit.Assert.assertNotNull;
2020
import static org.junit.Assert.assertTrue;
2121

@@ -204,7 +204,7 @@ int check (String value, String[] strings) {
204204

205205
// value should be expanded:
206206
int index= actualHtmlContent.indexOf("<pre><code>");
207-
assertFalse(index == -1);
207+
assertNotEquals(-1, index);
208208
String actualSnippet= actualHtmlContent.substring(index, index + expectedCodeSequence.length());
209209
assertEquals("sequence doesn't match", expectedCodeSequence, actualSnippet);
210210
}
@@ -255,7 +255,7 @@ int check (String value, String[] strings) {
255255

256256
// value should be expanded:
257257
int index= actualHtmlContent.indexOf("<pre>{");
258-
assertFalse(index == -1);
258+
assertNotEquals(-1, index);
259259
String actualSnippet= actualHtmlContent.substring(index, index + expectedCodeSequence.length());
260260
assertEquals("sequence doesn't match", expectedCodeSequence, actualSnippet);
261261
}
@@ -319,7 +319,7 @@ int check (String value, String[] strings) {
319319

320320
// value should be expanded:
321321
int index= actualHtmlContent.indexOf("<pre><code>");
322-
assertFalse(index == -1);
322+
assertNotEquals(-1, index);
323323
String actualSnippet= actualHtmlContent.substring(index, index + expectedCodeSequence.length());
324324
assertEquals("sequence doesn't match", actualSnippet, expectedCodeSequence);
325325
}

0 commit comments

Comments
 (0)