mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
classlib: remove deprecated constructors of primitive wrappers (#754)
This commit is contained in:
parent
94e34188c3
commit
7589eb23fc
|
@ -275,8 +275,8 @@ public abstract class TDateFormat extends TFormat {
|
||||||
protected Field(String fieldName, int calendarField) {
|
protected Field(String fieldName, int calendarField) {
|
||||||
super(fieldName);
|
super(fieldName);
|
||||||
this.calendarField = calendarField;
|
this.calendarField = calendarField;
|
||||||
if (calendarField != -1 && table.get(new Integer(calendarField)) == null) {
|
if (calendarField != -1 && table.get(calendarField) == null) {
|
||||||
table.put(new Integer(calendarField), this);
|
table.put(calendarField, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,7 +289,7 @@ public abstract class TDateFormat extends TFormat {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
return table.get(new Integer(calendarField));
|
return table.get(calendarField);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ abstract class TAbstractSet {
|
||||||
|
|
||||||
protected boolean isSecondPassVisited;
|
protected boolean isSecondPassVisited;
|
||||||
|
|
||||||
protected String index = new Integer(TAbstractSet.counter++).toString();
|
protected String index = Integer.toString(TAbstractSet.counter++);
|
||||||
|
|
||||||
private int type;
|
private int type;
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ class TQuantifier extends TSpecialToken implements Cloneable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "{" + min + "," + ((max == Integer.MAX_VALUE) ? "" : new Integer(max).toString()) + "}";
|
return "{" + min + "," + ((max == Integer.MAX_VALUE) ? "" : Integer.toString(max)) + "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class MessageFormatTest {
|
||||||
buffer.append(" def ");
|
buffer.append(" def ");
|
||||||
buffer.append(DateFormat.getDateInstance().format(date));
|
buffer.append(DateFormat.getDateInstance().format(date));
|
||||||
buffer.append(" ghi ");
|
buffer.append(" ghi ");
|
||||||
buffer.append(NumberFormat.getInstance().format(new Double(7.2)));
|
buffer.append(NumberFormat.getInstance().format(7.2));
|
||||||
buffer.append(" jkl high mnop 123");
|
buffer.append(" jkl high mnop 123");
|
||||||
assertTrue("Wrong answer:\n" + result + "\n" + buffer, result.equals(buffer.toString()));
|
assertTrue("Wrong answer:\n" + result + "\n" + buffer, result.equals(buffer.toString()));
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,7 @@ public class HashtableTest {
|
||||||
// Test for method java.util.Hashtable(java.util.Map)
|
// Test for method java.util.Hashtable(java.util.Map)
|
||||||
Map<String, Object> map = new TreeMap<>();
|
Map<String, Object> map = new TreeMap<>();
|
||||||
Object firstVal = "Gabba";
|
Object firstVal = "Gabba";
|
||||||
Object secondVal = new Integer(5);
|
Object secondVal = 5;
|
||||||
map.put("Gah", firstVal);
|
map.put("Gah", firstVal);
|
||||||
map.put("Ooga", secondVal);
|
map.put("Ooga", secondVal);
|
||||||
Hashtable<String, Object> ht = new Hashtable<>(map);
|
Hashtable<String, Object> ht = new Hashtable<>(map);
|
||||||
|
@ -386,9 +386,9 @@ public class HashtableTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<Integer, String> map = new Hashtable<>(101);
|
Map<Integer, String> map = new Hashtable<>(101);
|
||||||
map.put(new Integer(1), "1");
|
map.put(1, "1");
|
||||||
map.put(new Integer(102), "102");
|
map.put(102, "102");
|
||||||
map.put(new Integer(203), "203");
|
map.put(203, "203");
|
||||||
Iterator<Integer> it = map.keySet().iterator();
|
Iterator<Integer> it = map.keySet().iterator();
|
||||||
Integer remove1 = it.next();
|
Integer remove1 = it.next();
|
||||||
it.remove();
|
it.remove();
|
||||||
|
@ -402,15 +402,15 @@ public class HashtableTest {
|
||||||
assertTrue("Wrong contents", map.keySet().iterator().next().equals(list.get(0)));
|
assertTrue("Wrong contents", map.keySet().iterator().next().equals(list.get(0)));
|
||||||
|
|
||||||
Map<Integer, String> map2 = new Hashtable<>(101);
|
Map<Integer, String> map2 = new Hashtable<>(101);
|
||||||
map2.put(new Integer(1), "1");
|
map2.put(1, "1");
|
||||||
map2.put(new Integer(4), "4");
|
map2.put(4, "4");
|
||||||
Iterator<Integer> it2 = map2.keySet().iterator();
|
Iterator<Integer> it2 = map2.keySet().iterator();
|
||||||
Integer remove3 = it2.next();
|
Integer remove3 = it2.next();
|
||||||
Integer next;
|
Integer next;
|
||||||
if (remove3.intValue() == 1) {
|
if (remove3.intValue() == 1) {
|
||||||
next = new Integer(4);
|
next = 4;
|
||||||
} else {
|
} else {
|
||||||
next = new Integer(1);
|
next = 1;
|
||||||
}
|
}
|
||||||
it2.hasNext();
|
it2.hasNext();
|
||||||
it2.remove();
|
it2.remove();
|
||||||
|
@ -476,7 +476,7 @@ public class HashtableTest {
|
||||||
// Test for method java.lang.Object
|
// Test for method java.lang.Object
|
||||||
// java.util.Hashtable.put(java.lang.Object, java.lang.Object)
|
// java.util.Hashtable.put(java.lang.Object, java.lang.Object)
|
||||||
Hashtable<String, Integer> h = hashtableClone(ht100);
|
Hashtable<String, Integer> h = hashtableClone(ht100);
|
||||||
Integer key = new Integer(100);
|
Integer key = 100;
|
||||||
h.put("Value 100", key);
|
h.put("Value 100", key);
|
||||||
assertTrue("Key/Value not inserted", h.size() == 1 && (h.contains(key)));
|
assertTrue("Key/Value not inserted", h.size() == 1 && (h.contains(key)));
|
||||||
}
|
}
|
||||||
|
@ -558,13 +558,13 @@ public class HashtableTest {
|
||||||
|
|
||||||
Hashtable<Integer, Integer> myHashtable = new Hashtable<>();
|
Hashtable<Integer, Integer> myHashtable = new Hashtable<>();
|
||||||
for (int i = 0; i < 100; i++) {
|
for (int i = 0; i < 100; i++) {
|
||||||
myHashtable.put(new Integer(i), new Integer(i));
|
myHashtable.put(i, i);
|
||||||
}
|
}
|
||||||
Collection<Integer> values = myHashtable.values();
|
Collection<Integer> values = myHashtable.values();
|
||||||
new UnmodifiableCollectionTestSupport(values).runTest();
|
new UnmodifiableCollectionTestSupport(values).runTest();
|
||||||
values.remove(new Integer(0));
|
values.remove(0);
|
||||||
assertTrue("Removing from the values collection should remove from the original map",
|
assertTrue("Removing from the values collection should remove from the original map",
|
||||||
!myHashtable.containsValue(new Integer(0)));
|
!myHashtable.containsValue(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -126,9 +126,8 @@ public class TreeMapTest {
|
||||||
public TreeMapTest() {
|
public TreeMapTest() {
|
||||||
tm = new TreeMap<>();
|
tm = new TreeMap<>();
|
||||||
for (int i = 0; i < objArray.length; i++) {
|
for (int i = 0; i < objArray.length; i++) {
|
||||||
Object x = new Integer(i);
|
objArray[i] = i;
|
||||||
objArray[i] = x;
|
tm.put(Integer.toString(i), i);
|
||||||
tm.put(x.toString(), x);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,12 +138,12 @@ public class TreeMapTest {
|
||||||
TreeMap<Object, Object> reversedTreeMap = new TreeMap<>(comp);
|
TreeMap<Object, Object> reversedTreeMap = new TreeMap<>(comp);
|
||||||
assertTrue("TreeMap answered incorrect comparator", reversedTreeMap
|
assertTrue("TreeMap answered incorrect comparator", reversedTreeMap
|
||||||
.comparator() == comp);
|
.comparator() == comp);
|
||||||
reversedTreeMap.put(new Integer(1).toString(), new Integer(1));
|
reversedTreeMap.put(Integer.toString(1), 1);
|
||||||
reversedTreeMap.put(new Integer(2).toString(), new Integer(2));
|
reversedTreeMap.put(Integer.toString(2), 2);
|
||||||
assertTrue("TreeMap does not use comparator (firstKey was incorrect)",
|
assertTrue("TreeMap does not use comparator (firstKey was incorrect)",
|
||||||
reversedTreeMap.firstKey().equals(new Integer(2).toString()));
|
reversedTreeMap.firstKey().equals(Integer.toString(2)));
|
||||||
assertTrue("TreeMap does not use comparator (lastKey was incorrect)",
|
assertTrue("TreeMap does not use comparator (lastKey was incorrect)",
|
||||||
reversedTreeMap.lastKey().equals(new Integer(1).toString()));
|
reversedTreeMap.lastKey().equals(Integer.toString(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -162,15 +161,15 @@ public class TreeMapTest {
|
||||||
// Test for method java.util.TreeMap(java.util.SortedMap)
|
// Test for method java.util.TreeMap(java.util.SortedMap)
|
||||||
Comparator<Object> comp = new ReversedComparator();
|
Comparator<Object> comp = new ReversedComparator();
|
||||||
TreeMap<Object, Object> reversedTreeMap = new TreeMap<>(comp);
|
TreeMap<Object, Object> reversedTreeMap = new TreeMap<>(comp);
|
||||||
reversedTreeMap.put(new Integer(1).toString(), new Integer(1));
|
reversedTreeMap.put(Integer.toString(1), 1);
|
||||||
reversedTreeMap.put(new Integer(2).toString(), new Integer(2));
|
reversedTreeMap.put(Integer.toString(2), 2);
|
||||||
TreeMap<Object, Object> anotherTreeMap = new TreeMap<>(reversedTreeMap);
|
TreeMap<Object, Object> anotherTreeMap = new TreeMap<>(reversedTreeMap);
|
||||||
assertTrue("New tree map does not answer correct comparator",
|
assertTrue("New tree map does not answer correct comparator",
|
||||||
anotherTreeMap.comparator() == comp);
|
anotherTreeMap.comparator() == comp);
|
||||||
assertTrue("TreeMap does not use comparator (firstKey was incorrect)",
|
assertTrue("TreeMap does not use comparator (firstKey was incorrect)",
|
||||||
anotherTreeMap.firstKey().equals(new Integer(2).toString()));
|
anotherTreeMap.firstKey().equals(Integer.toString(2)));
|
||||||
assertTrue("TreeMap does not use comparator (lastKey was incorrect)",
|
assertTrue("TreeMap does not use comparator (lastKey was incorrect)",
|
||||||
anotherTreeMap.lastKey().equals(new Integer(1).toString()));
|
anotherTreeMap.lastKey().equals(Integer.toString(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -219,12 +218,12 @@ public class TreeMapTest {
|
||||||
Comparator<Object> comp = new ReversedComparator();
|
Comparator<Object> comp = new ReversedComparator();
|
||||||
TreeMap<Object, Object> reversedTreeMap = new TreeMap<>(comp);
|
TreeMap<Object, Object> reversedTreeMap = new TreeMap<>(comp);
|
||||||
assertTrue("TreeMap answered incorrect comparator", reversedTreeMap.comparator() == comp);
|
assertTrue("TreeMap answered incorrect comparator", reversedTreeMap.comparator() == comp);
|
||||||
reversedTreeMap.put(new Integer(1).toString(), new Integer(1));
|
reversedTreeMap.put(Integer.toString(1), 1);
|
||||||
reversedTreeMap.put(new Integer(2).toString(), new Integer(2));
|
reversedTreeMap.put(Integer.toString(2), 2);
|
||||||
assertTrue("TreeMap does not use comparator (firstKey was incorrect)",
|
assertTrue("TreeMap does not use comparator (firstKey was incorrect)",
|
||||||
reversedTreeMap.firstKey().equals(new Integer(2).toString()));
|
reversedTreeMap.firstKey().equals(Integer.toString(2)));
|
||||||
assertTrue("TreeMap does not use comparator (lastKey was incorrect)",
|
assertTrue("TreeMap does not use comparator (lastKey was incorrect)",
|
||||||
reversedTreeMap.lastKey().equals(new Integer(1).toString()));
|
reversedTreeMap.lastKey().equals(Integer.toString(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -280,7 +279,7 @@ public class TreeMapTest {
|
||||||
Map<Object, Object> head = tm.headMap("100");
|
Map<Object, Object> head = tm.headMap("100");
|
||||||
assertEquals("Returned map of incorrect size", 3, head.size());
|
assertEquals("Returned map of incorrect size", 3, head.size());
|
||||||
assertTrue("Returned incorrect elements", head.containsKey("0")
|
assertTrue("Returned incorrect elements", head.containsKey("0")
|
||||||
&& head.containsValue(new Integer("1"))
|
&& head.containsValue(Integer.parseInt("1"))
|
||||||
&& head.containsKey("10"));
|
&& head.containsKey("10"));
|
||||||
|
|
||||||
// Regression for Harmony-1026
|
// Regression for Harmony-1026
|
||||||
|
@ -377,7 +376,7 @@ public class TreeMapTest {
|
||||||
Set<Object> ks = tm.keySet();
|
Set<Object> ks = tm.keySet();
|
||||||
assertTrue("Returned set of incorrect size", ks.size() == objArray.length);
|
assertTrue("Returned set of incorrect size", ks.size() == objArray.length);
|
||||||
for (int i = 0; i < tm.size(); i++) {
|
for (int i = 0; i < tm.size(); i++) {
|
||||||
assertTrue("Returned set is missing keys", ks.contains(new Integer(i).toString()));
|
assertTrue("Returned set is missing keys", ks.contains(Integer.toString(i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,7 +395,7 @@ public class TreeMapTest {
|
||||||
assertTrue("Failed to put mapping", tm.get("Hello") == o);
|
assertTrue("Failed to put mapping", tm.get("Hello") == o);
|
||||||
|
|
||||||
tm = new TreeMap<>();
|
tm = new TreeMap<>();
|
||||||
assertNull(tm.put(new Integer(1), new Object()));
|
assertNull(tm.put(1, new Object()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -567,9 +566,9 @@ public class TreeMapTest {
|
||||||
myTreeMap.put(objArray[i], objArray[i]);
|
myTreeMap.put(objArray[i], objArray[i]);
|
||||||
}
|
}
|
||||||
Collection<Object> values = myTreeMap.values();
|
Collection<Object> values = myTreeMap.values();
|
||||||
values.remove(new Integer(0));
|
values.remove(0);
|
||||||
assertTrue("Removing from the values collection should remove from the original map",
|
assertTrue("Removing from the values collection should remove from the original map",
|
||||||
!myTreeMap.containsValue(new Integer(0)));
|
!myTreeMap.containsValue(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class MatcherTest {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
|
|
||||||
for (int i = 0; m.find(); i++) {
|
for (int i = 0; m.find(); i++) {
|
||||||
m.appendReplacement(sb, new Integer(i * 10 + i).toString());
|
m.appendReplacement(sb, Integer.toString(i * 10 + i));
|
||||||
}
|
}
|
||||||
m.appendTail(sb);
|
m.appendTail(sb);
|
||||||
assertEquals("Today is 0-11-22 ...", sb.toString());
|
assertEquals("Today is 0-11-22 ...", sb.toString());
|
||||||
|
@ -120,7 +120,7 @@ public class MatcherTest {
|
||||||
Matcher m = p.matcher("xx $ equals to xx rur.");
|
Matcher m = p.matcher("xx $ equals to xx rur.");
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
for (int i = 1; m.find(); i *= 30) {
|
for (int i = 1; m.find(); i *= 30) {
|
||||||
String rep = new Integer(i).toString() + " $1";
|
String rep = i + " $1";
|
||||||
m.appendReplacement(sb, rep);
|
m.appendReplacement(sb, rep);
|
||||||
}
|
}
|
||||||
m.appendTail(sb);
|
m.appendTail(sb);
|
||||||
|
|
|
@ -608,16 +608,16 @@ public class PatternTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBug197() {
|
public void testBug197() {
|
||||||
Object[] vals = { ":", new Integer(2),
|
Object[] vals = { ":", 2,
|
||||||
new String[] { "boo", "and:foo" }, ":", new Integer(5),
|
new String[] { "boo", "and:foo" }, ":", 5,
|
||||||
new String[] { "boo", "and", "foo" }, ":", new Integer(-2),
|
new String[] { "boo", "and", "foo" }, ":", -2,
|
||||||
new String[] { "boo", "and", "foo" }, ":", new Integer(3),
|
new String[] { "boo", "and", "foo" }, ":", 3,
|
||||||
new String[] { "boo", "and", "foo" }, ":", new Integer(1),
|
new String[] { "boo", "and", "foo" }, ":", 1,
|
||||||
new String[] { "boo:and:foo" }, "o", new Integer(5),
|
new String[] { "boo:and:foo" }, "o", 5,
|
||||||
new String[] { "b", "", ":and:f", "", "" }, "o",
|
new String[] { "b", "", ":and:f", "", "" }, "o",
|
||||||
new Integer(4), new String[] { "b", "", ":and:f", "o" }, "o",
|
4, new String[] { "b", "", ":and:f", "o" }, "o",
|
||||||
new Integer(-2), new String[] { "b", "", ":and:f", "", "" },
|
-2, new String[] { "b", "", ":and:f", "", "" },
|
||||||
"o", new Integer(0), new String[] { "b", "", ":and:f" } };
|
"o", 0, new String[] { "b", "", ":and:f" } };
|
||||||
|
|
||||||
for (int i = 0; i < vals.length / 3;) {
|
for (int i = 0; i < vals.length / 3;) {
|
||||||
String[] res = Pattern.compile(vals[i++].toString()).split("boo:and:foo", (Integer) vals[i++]);
|
String[] res = Pattern.compile(vals[i++].toString()).split("boo:and:foo", (Integer) vals[i++]);
|
||||||
|
|
|
@ -68,17 +68,17 @@ public class CollectionTestSupport {
|
||||||
|
|
||||||
// setup
|
// setup
|
||||||
Collection<Integer> myCollection = new TreeSet<>();
|
Collection<Integer> myCollection = new TreeSet<>();
|
||||||
myCollection.add(new Integer(101));
|
myCollection.add(101);
|
||||||
myCollection.add(new Integer(102));
|
myCollection.add(102);
|
||||||
myCollection.add(new Integer(103));
|
myCollection.add(103);
|
||||||
|
|
||||||
// add
|
// add
|
||||||
assertTrue("CollectionTest - a) add did not work", col.add(new Integer(101)));
|
assertTrue("CollectionTest - a) add did not work", col.add(101));
|
||||||
assertTrue("CollectionTest - b) add did not work", col.contains(new Integer(101)));
|
assertTrue("CollectionTest - b) add did not work", col.contains(101));
|
||||||
|
|
||||||
// remove
|
// remove
|
||||||
assertTrue("CollectionTest - a) remove did not work", col.remove(new Integer(101)));
|
assertTrue("CollectionTest - a) remove did not work", col.remove(101));
|
||||||
assertTrue("CollectionTest - b) remove did not work", !col.contains(new Integer(101)));
|
assertTrue("CollectionTest - b) remove did not work", !col.contains(101));
|
||||||
|
|
||||||
// addAll
|
// addAll
|
||||||
assertTrue("CollectionTest - a) addAll failed", col.addAll(myCollection));
|
assertTrue("CollectionTest - a) addAll failed", col.addAll(myCollection));
|
||||||
|
@ -86,28 +86,26 @@ public class CollectionTestSupport {
|
||||||
|
|
||||||
// containsAll
|
// containsAll
|
||||||
assertTrue("CollectionTest - a) containsAll failed", col.containsAll(myCollection));
|
assertTrue("CollectionTest - a) containsAll failed", col.containsAll(myCollection));
|
||||||
col.remove(new Integer(101));
|
col.remove(101);
|
||||||
assertTrue("CollectionTest - b) containsAll failed", !col.containsAll(myCollection));
|
assertTrue("CollectionTest - b) containsAll failed", !col.containsAll(myCollection));
|
||||||
|
|
||||||
// removeAll
|
// removeAll
|
||||||
assertTrue("CollectionTest - a) removeAll failed", col.removeAll(myCollection));
|
assertTrue("CollectionTest - a) removeAll failed", col.removeAll(myCollection));
|
||||||
assertTrue("CollectionTest - b) removeAll failed", !col.removeAll(myCollection));
|
assertTrue("CollectionTest - b) removeAll failed", !col.removeAll(myCollection));
|
||||||
assertTrue("CollectionTest - c) removeAll failed", !col.contains(new Integer(102)));
|
assertTrue("CollectionTest - c) removeAll failed", !col.contains(102));
|
||||||
assertTrue("CollectionTest - d) removeAll failed", !col.contains(new Integer(103)));
|
assertTrue("CollectionTest - d) removeAll failed", !col.contains(103));
|
||||||
|
|
||||||
// retianAll
|
// retianAll
|
||||||
col.addAll(myCollection);
|
col.addAll(myCollection);
|
||||||
assertTrue("CollectionTest - a) retainAll failed", col.retainAll(myCollection));
|
assertTrue("CollectionTest - a) retainAll failed", col.retainAll(myCollection));
|
||||||
assertTrue("CollectionTest - b) retainAll failed", !col.retainAll(myCollection));
|
assertTrue("CollectionTest - b) retainAll failed", !col.retainAll(myCollection));
|
||||||
assertTrue("CollectionTest - c) retainAll failed", col.containsAll(myCollection));
|
assertTrue("CollectionTest - c) retainAll failed", col.containsAll(myCollection));
|
||||||
assertTrue("CollectionTest - d) retainAll failed", !col.contains(new Integer(0)));
|
assertTrue("CollectionTest - d) retainAll failed", !col.contains(0));
|
||||||
assertTrue("CollectionTest - e) retainAll failed", !col.contains(new Integer(50)));
|
assertTrue("CollectionTest - e) retainAll failed", !col.contains(50));
|
||||||
|
|
||||||
// clear
|
// clear
|
||||||
col.clear();
|
col.clear();
|
||||||
assertTrue("CollectionTest - a) clear failed", col.isEmpty());
|
assertTrue("CollectionTest - a) clear failed", col.isEmpty());
|
||||||
assertTrue("CollectionTest - b) clear failed", !col.contains(new Integer(101)));
|
assertTrue("CollectionTest - b) clear failed", !col.contains(101));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,51 +71,51 @@ public class ListTestSupport {
|
||||||
Object elem;
|
Object elem;
|
||||||
elem = list.get(counter);
|
elem = list.get(counter);
|
||||||
hashCode = 31 * hashCode + elem.hashCode();
|
hashCode = 31 * hashCode + elem.hashCode();
|
||||||
assertTrue("ListTest - get failed", elem.equals(new Integer(counter)));
|
assertTrue("ListTest - get failed", elem.equals(counter));
|
||||||
}
|
}
|
||||||
assertTrue("ListTest - hashCode failed", hashCode == list.hashCode());
|
assertTrue("ListTest - hashCode failed", hashCode == list.hashCode());
|
||||||
|
|
||||||
list.add(50, new Integer(1000));
|
list.add(50, 1000);
|
||||||
assertTrue("ListTest - a) add with index failed--did not insert", list.get(50).equals(new Integer(1000)));
|
assertTrue("ListTest - a) add with index failed--did not insert", list.get(50).equals(1000));
|
||||||
assertTrue("ListTest - b) add with index failed--did not move following elements",
|
assertTrue("ListTest - b) add with index failed--did not move following elements",
|
||||||
list.get(51).equals(new Integer(50)));
|
list.get(51).equals(50));
|
||||||
assertTrue("ListTest - c) add with index failed--affected previous elements",
|
assertTrue("ListTest - c) add with index failed--affected previous elements",
|
||||||
list.get(49).equals(new Integer(49)));
|
list.get(49).equals(49));
|
||||||
|
|
||||||
list.set(50, new Integer(2000));
|
list.set(50, 2000);
|
||||||
assertTrue("ListTest - a) set failed--did not set", list.get(50).equals(new Integer(2000)));
|
assertTrue("ListTest - a) set failed--did not set", list.get(50).equals(2000));
|
||||||
assertTrue("ListTest - b) set failed--affected following elements", list.get(51).equals(new Integer(50)));
|
assertTrue("ListTest - b) set failed--affected following elements", list.get(51).equals(50));
|
||||||
assertTrue("ListTest - c) set failed--affected previous elements", list.get(49).equals(new Integer(49)));
|
assertTrue("ListTest - c) set failed--affected previous elements", list.get(49).equals(49));
|
||||||
|
|
||||||
list.remove(50);
|
list.remove(50);
|
||||||
assertTrue("ListTest - a) remove with index failed--did not remove", list.get(50).equals(new Integer(50)));
|
assertTrue("ListTest - a) remove with index failed--did not remove", list.get(50).equals(50));
|
||||||
assertTrue("ListTest - b) remove with index failed--did not move following elements",
|
assertTrue("ListTest - b) remove with index failed--did not move following elements",
|
||||||
list.get(51).equals(new Integer(51)));
|
list.get(51).equals(51));
|
||||||
assertTrue("ListTest - c) remove with index failed--affected previous elements",
|
assertTrue("ListTest - c) remove with index failed--affected previous elements",
|
||||||
list.get(49).equals(new Integer(49)));
|
list.get(49).equals(49));
|
||||||
|
|
||||||
List<Integer> myList = new LinkedList<>();
|
List<Integer> myList = new LinkedList<>();
|
||||||
myList.add(new Integer(500));
|
myList.add(500);
|
||||||
myList.add(new Integer(501));
|
myList.add(501);
|
||||||
myList.add(new Integer(502));
|
myList.add(502);
|
||||||
|
|
||||||
list.addAll(50, myList);
|
list.addAll(50, myList);
|
||||||
assertTrue("ListTest - a) addAll with index failed--did not insert", list.get(50).equals(new Integer(500)));
|
assertTrue("ListTest - a) addAll with index failed--did not insert", list.get(50).equals(500));
|
||||||
assertTrue("ListTest - b) addAll with index failed--did not insert", list.get(51).equals(new Integer(501)));
|
assertTrue("ListTest - b) addAll with index failed--did not insert", list.get(51).equals(501));
|
||||||
assertTrue("ListTest - c) addAll with index failed--did not insert", list.get(52).equals(new Integer(502)));
|
assertTrue("ListTest - c) addAll with index failed--did not insert", list.get(52).equals(502));
|
||||||
assertTrue("ListTest - d) addAll with index failed--did not move following elements",
|
assertTrue("ListTest - d) addAll with index failed--did not move following elements",
|
||||||
list.get(53).equals(new Integer(50)));
|
list.get(53).equals(50));
|
||||||
assertTrue("ListTest - e) addAll with index failed--affected previous elements",
|
assertTrue("ListTest - e) addAll with index failed--affected previous elements",
|
||||||
list.get(49).equals(new Integer(49)));
|
list.get(49).equals(49));
|
||||||
|
|
||||||
List<Integer> mySubList = list.subList(50, 53);
|
List<Integer> mySubList = list.subList(50, 53);
|
||||||
assertEquals(3, mySubList.size());
|
assertEquals(3, mySubList.size());
|
||||||
assertTrue("ListTest - a) sublist Failed--does not contain correct elements",
|
assertTrue("ListTest - a) sublist Failed--does not contain correct elements",
|
||||||
mySubList.get(0).equals(new Integer(500)));
|
mySubList.get(0).equals(500));
|
||||||
assertTrue("ListTest - b) sublist Failed--does not contain correct elements",
|
assertTrue("ListTest - b) sublist Failed--does not contain correct elements",
|
||||||
mySubList.get(1).equals(new Integer(501)));
|
mySubList.get(1).equals(501));
|
||||||
assertTrue("ListTest - c) sublist Failed--does not contain correct elements",
|
assertTrue("ListTest - c) sublist Failed--does not contain correct elements",
|
||||||
mySubList.get(2).equals(new Integer(502)));
|
mySubList.get(2).equals(502));
|
||||||
|
|
||||||
t_listIterator(mySubList);
|
t_listIterator(mySubList);
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ public class ListTestSupport {
|
||||||
for (int counter = 0; li.hasNext(); counter++) {
|
for (int counter = 0; li.hasNext(); counter++) {
|
||||||
Object elem;
|
Object elem;
|
||||||
elem = li.next();
|
elem = li.next();
|
||||||
assertTrue("ListTest - listIterator failed", elem.equals(new Integer(counter)));
|
assertTrue("ListTest - listIterator failed", elem.equals(counter));
|
||||||
}
|
}
|
||||||
|
|
||||||
new CollectionTestSupport(list).runTest();
|
new CollectionTestSupport(list).runTest();
|
||||||
|
@ -186,8 +186,8 @@ public class ListTestSupport {
|
||||||
}
|
}
|
||||||
assertTrue("list iterator previous() exception", exception);
|
assertTrue("list iterator previous() exception", exception);
|
||||||
|
|
||||||
Integer add1 = new Integer(600);
|
Integer add1 = 600;
|
||||||
Integer add2 = new Integer(601);
|
Integer add2 = 601;
|
||||||
li.add(add1);
|
li.add(add1);
|
||||||
assertTrue("list iterator add(), size()", list.size() == (orgSize + 1));
|
assertTrue("list iterator add(), size()", list.size() == (orgSize + 1));
|
||||||
assertEquals("list iterator add(), nextIndex()", 1, li.nextIndex());
|
assertEquals("list iterator add(), nextIndex()", 1, li.nextIndex());
|
||||||
|
|
|
@ -71,21 +71,21 @@ public class UnmodifiableCollectionTestSupport {
|
||||||
|
|
||||||
// contains
|
// contains
|
||||||
assertTrue("UnmodifiableCollectionTest - should contain 0", col
|
assertTrue("UnmodifiableCollectionTest - should contain 0", col
|
||||||
.contains(new Integer(0)));
|
.contains(0));
|
||||||
assertTrue("UnmodifiableCollectionTest - should contain 50", col
|
assertTrue("UnmodifiableCollectionTest - should contain 50", col
|
||||||
.contains(new Integer(50)));
|
.contains(50));
|
||||||
assertTrue("UnmodifiableCollectionTest - should not contain 100", !col
|
assertTrue("UnmodifiableCollectionTest - should not contain 100", !col
|
||||||
.contains(new Integer(100)));
|
.contains(100));
|
||||||
|
|
||||||
// containsAll
|
// containsAll
|
||||||
HashSet<Integer> hs = new HashSet<>();
|
HashSet<Integer> hs = new HashSet<>();
|
||||||
hs.add(new Integer(0));
|
hs.add(0);
|
||||||
hs.add(new Integer(25));
|
hs.add(25);
|
||||||
hs.add(new Integer(99));
|
hs.add(99);
|
||||||
assertTrue(
|
assertTrue(
|
||||||
"UnmodifiableCollectionTest - should contain set of 0, 25, and 99",
|
"UnmodifiableCollectionTest - should contain set of 0, 25, and 99",
|
||||||
col.containsAll(hs));
|
col.containsAll(hs));
|
||||||
hs.add(new Integer(100));
|
hs.add(100);
|
||||||
assertTrue(
|
assertTrue(
|
||||||
"UnmodifiableCollectionTest - should not contain set of 0, 25, 99 and 100",
|
"UnmodifiableCollectionTest - should not contain set of 0, 25, 99 and 100",
|
||||||
!col.containsAll(hs));
|
!col.containsAll(hs));
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class DependencyTestData {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void arrays() {
|
public static void arrays() {
|
||||||
Object[] array = { new String("123"), new Integer(123), String.class };
|
Object[] array = { new String("123"), 123, String.class };
|
||||||
MetaAssertions.assertTypes(array[0], String.class, Integer.class, Class.class);
|
MetaAssertions.assertTypes(array[0], String.class, Integer.class, Class.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user