GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — list vs set unit test (#12807) · FEDENG01/tutorials@0a2a7bd

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • core-java-modules/core-java-collections-4/src/test/java/com/baeldung/listandset
    • ListAndSetUnitTest.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎core-java-modules/core-java-collections-4/src/test/java/com/baeldung/listandset/ListAndSetUnitTest.java‎

Copy file name to clipboardExpand all lines: core-java-modules/core-java-collections-4/src/test/java/com/baeldung/listandset/ListAndSetUnitTest.java
+3-11Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.baeldung.listandset;
22

33
import org.junit.Test;
4+
import org.junit.Assert;
45
import java.util.*;
56
import static org.junit.Assert.assertEquals;
67
import static org.junit.Assert.assertTrue;
@@ -37,15 +38,6 @@ public void givenSet_whenOrdering_thenMayBeAllowed(){
3738
set2.add(2);
3839
set2.add(3);
3940
set2.add(4);
40-
boolean ordered = true;
41-
Object[] arr1 = set1.toArray();
42-
Object[] arr2 = set2.toArray();
43-
for(int i=0; i < arr1.length; i++){
44-
if (!arr1[i].equals(arr2[i])) {
45-
ordered = false;
46-
break;
47-
}
48-
}
49-
assertTrue(ordered);
41+
Assert.assertArrayEquals(set1.toArray(), set2.toArray());
5042
}
51-
}
43+
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.