Skip to content

Commit

Permalink
Move testSort to java8 tests and fix List.replaceAll test.
Browse files Browse the repository at this point in the history
Change-Id: I90f515888fa065eb31502e7b1fe2d6e94c470ec2
  • Loading branch information
korzha committed May 27, 2016
1 parent c32d7d1 commit 978e3cd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
17 changes: 0 additions & 17 deletions user/test/com/google/gwt/emultest/java/util/ArrayListTest.java
Expand Up @@ -15,11 +15,8 @@
*/ */
package com.google.gwt.emultest.java.util; package com.google.gwt.emultest.java.util;


import static java.util.Arrays.asList;

import java.util.AbstractList; import java.util.AbstractList;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.ListIterator; import java.util.ListIterator;


Expand Down Expand Up @@ -129,20 +126,6 @@ public void testRemoveRange() {
assertEquals(0, l.size()); assertEquals(0, l.size());
} }


public void testSort() {
ArrayList<String> list = new ArrayList<>();
list.sort(null);

Collections.addAll(list, "b", "a", "c");
list.sort(null);
assertEquals(asList("a", "b", "c"), list);

list = new ArrayList<>();
Collections.addAll(list, "b", "a", "c");
list.sort(Collections.reverseOrder());
assertEquals(asList("c", "b", "a"), list);
}

@Override @Override
protected List makeEmptyList() { protected List makeEmptyList() {
return new ArrayList(); return new ArrayList();
Expand Down
Expand Up @@ -83,7 +83,7 @@ public void testRemoveIf() {
} }


public void testReplaceAll() { public void testReplaceAll() {
ArrayList<String> list = new ArrayList<>(); List<String> list = createEmptyList();


try { try {
list.replaceAll(null); list.replaceAll(null);
Expand All @@ -106,6 +106,20 @@ public void testReplaceAll() {
assertEquals(asList("a01", "b01", "c1"), list); assertEquals(asList("a01", "b01", "c1"), list);
} }


public void testSort() {
List<String> list = createEmptyList();
list.sort(null);

Collections.addAll(list, "b", "a", "c");
list.sort(null);
assertEquals(asList("a", "b", "c"), list);

list = createEmptyList();
Collections.addAll(list, "b", "a", "c");
list.sort(Collections.reverseOrder());
assertEquals(asList("c", "b", "a"), list);
}

protected abstract List<String> createEmptyList(); protected abstract List<String> createEmptyList();


} }

0 comments on commit 978e3cd

Please sign in to comment.