Browse Source

unittest-demo (#1337)

pull/2/head
khadgarmage 5 years ago committed by dailidong
parent
commit
da88597717
  1. 14
      dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/CollectionUtilsTest.java

14
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/CollectionUtilsTest.java

@ -30,34 +30,30 @@ public class CollectionUtilsTest {
@Test
public void equalLists() {
List<Integer> a = new ArrayList<Integer>();
a.add(1);
a.add(2);
a.add(3);
List<Integer> b = new ArrayList<Integer>();
b.add(3);
b.add(2);
b.add(1);
Assert.assertTrue(CollectionUtils.equalLists(a,b));
Assert.assertTrue(CollectionUtils.equalLists(null,null));
List<Integer> c = new ArrayList<Integer>();
Assert.assertFalse(CollectionUtils.equalLists(c,null));
Assert.assertFalse(CollectionUtils.equalLists(c,a));
}
@Test
public void subtract() {
Set<Integer> a = new HashSet<Integer>();
a.add(1);
a.add(2);
a.add(3);
Set<Integer> b = new HashSet<Integer>();
b.add(0);
b.add(2);
b.add(4);
Assert.assertArrayEquals(new Integer[]{1,3},CollectionUtils.subtract(a,b).toArray());
}
}
}

Loading…
Cancel
Save