You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sm...@apache.org on 2006/05/15 07:07:34 UTC
svn commit: r406538 -
/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/AbstractCollectionTest.java
Author: smishura
Date: Sun May 14 22:07:33 2006
New Revision: 406538
URL: http://svn.apache.org/viewcvs?rev=406538&view=rev
Log:
Reformatting code to 4 space indent
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/AbstractCollectionTest.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/AbstractCollectionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/AbstractCollectionTest.java?rev=406538&r1=406537&r2=406538&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/AbstractCollectionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/AbstractCollectionTest.java Sun May 14 22:07:33 2006
@@ -21,155 +21,155 @@
public class AbstractCollectionTest extends junit.framework.TestCase {
- Collection org;
+ Collection org;
- /**
- * @tests java.util.AbstractCollection#add(java.lang.Object)
- */
- public void test_addLjava_lang_Object() {
- assertTrue("Nothing to test--unsupported operation", true);
- }
-
- /**
- * @tests java.util.AbstractCollection#addAll(java.util.Collection)
- */
- public void test_addAllLjava_util_Collection() {
- Collection col = new HashSet();
- col.addAll(org);
- assertTrue("Collection is wrong size after addAll--wanted: 100 got: "
- + col.size(), col.size() == 100);
- }
-
- /**
- * @tests java.util.AbstractCollection#containsAll(java.util.Collection)
- */
- public void test_containsAllLjava_util_Collection() {
- ArrayList col = new ArrayList(org);
- assertTrue("Should contain all of the elements it started with", col
- .containsAll(org));
- col.remove(5);
- assertTrue(
- "Should no longer contain all of the elements it started with",
- !col.containsAll(org));
- }
-
- /**
- * @tests java.util.AbstractCollection#isEmpty()
- */
- public void test_isEmpty() {
- Collection col = new ArrayList();
- assertTrue("Should be empty when created", col.isEmpty());
- col.addAll(org);
- assertTrue("Should not be empty", !col.isEmpty());
- col.clear();
- assertTrue("Should be empty after clear", col.isEmpty());
- }
-
- /**
- * @tests java.util.AbstractCollection#removeAll(java.util.Collection)
- */
- public void test_removeAllLjava_util_Collection() {
- Collection someCol = new HashSet(org);
- Collection anotherCol = new HashSet(org);
- anotherCol.remove(new Integer(5));
- someCol.removeAll(anotherCol);
- assertTrue("Collection is the wrong size--wanted 1, got: "
- + someCol.size(), someCol.size() == 1);
- someCol.remove(new Integer(5));
- assertTrue("Collection is the wrong size--wanted 0, got: "
- + someCol.size(), someCol.size() == 0);
- }
-
- /**
- * @tests java.util.AbstractCollection#retainAll(java.util.Collection)
- */
- public void test_retainAllLjava_util_Collection() {
- Collection someCol = new HashSet(org);
- Collection anotherCol = new HashSet(org);
- anotherCol.remove(new Integer(5));
- someCol.retainAll(anotherCol);
- assertTrue("Collection is the wrong size--wanted 99, got: "
- + someCol.size(), someCol.size() == 99);
- someCol.add(new Integer(5));
- assertTrue("Collection is the wrong size--wanted 100, got: "
- + someCol.size(), someCol.size() == 100);
- }
-
- /**
- * @tests java.util.AbstractCollection#toArray()
- */
- public void test_toArray() {
- Object[] objArray = org.toArray();
- assertTrue("The returned array is the wrong length--wanted 100, got: "
- + objArray.length, objArray.length == 100);
- HashSet duplicates = new HashSet();
- for (int i = objArray.length - 1; i >= 0; i--) {
- assertTrue("The returned array has an incorrect value. At i = " + i
- + " got: " + ((Integer) objArray[i]).intValue(), org
- .contains(objArray[i]));
- assertTrue("Duplicate found at i = " + i, !duplicates
- .contains(objArray[i]));
- duplicates.add(objArray[i]);
- }
- }
-
- /**
- * @tests java.util.AbstractCollection#toArray(java.lang.Object[])
- */
- public void test_toArray$Ljava_lang_Object() {
- Object[] objArray = new Object[100];
- org.toArray(objArray);
- assertTrue(
- "a) The returned array is the wrong length--wanted 100, got: "
- + objArray.length, objArray.length == 100);
- HashSet duplicates = new HashSet();
- for (int i = objArray.length - 1; i >= 0; i--) {
- assertTrue("a) The returned array has an incorrect value at i = "
- + i, org.contains(objArray[i]));
- assertTrue("Duplicate found at i = " + i, !duplicates
- .contains(objArray[i]));
- duplicates.add(objArray[i]);
- }
-
- Integer[] intArray = new Integer[105];
- intArray[100] = new Integer(1203);
- org.toArray(intArray);
- assertTrue(
- "b) The returned array is the wrong length--wanted 105, got: "
- + intArray.length, intArray.length == 105);
- duplicates = new HashSet();
- for (int i = 99; i >= 0; i--) {
- assertTrue("b) The returned array has an incorrect value at i = "
- + i, org.contains(intArray[i]));
- assertTrue("Duplicate found at i = " + i, !duplicates
- .contains(intArray[i]));
- duplicates.add(intArray[i]);
- }
- assertNull("End of list should be null", intArray[100]);
-
- intArray = new Integer[1];
- intArray = (Integer[]) org.toArray(intArray);
- assertTrue(
- "c) The returned array is the wrong length--wanted 100, got: "
- + intArray.length, intArray.length == 100);
- duplicates = new HashSet();
- for (int i = intArray.length - 1; i >= 0; i--) {
- assertTrue("c) The returned array has an incorrect value. At i = "
- + i + " got: " + intArray[i].intValue(), org
- .contains(intArray[i]));
- assertTrue("Duplicate found at i = " + i, !duplicates
- .contains(intArray[i]));
- duplicates.add(intArray[i]);
- }
- }
-
- protected void setUp() {
- org = new HashSet();
- for (int i = 0; i < 100; i++)
- org.add(new Integer(i));
+ /**
+ * @tests java.util.AbstractCollection#add(java.lang.Object)
+ */
+ public void test_addLjava_lang_Object() {
+ assertTrue("Nothing to test--unsupported operation", true);
+ }
+
+ /**
+ * @tests java.util.AbstractCollection#addAll(java.util.Collection)
+ */
+ public void test_addAllLjava_util_Collection() {
+ Collection col = new HashSet();
+ col.addAll(org);
+ assertTrue("Collection is wrong size after addAll--wanted: 100 got: "
+ + col.size(), col.size() == 100);
+ }
+
+ /**
+ * @tests java.util.AbstractCollection#containsAll(java.util.Collection)
+ */
+ public void test_containsAllLjava_util_Collection() {
+ ArrayList col = new ArrayList(org);
+ assertTrue("Should contain all of the elements it started with", col
+ .containsAll(org));
+ col.remove(5);
+ assertTrue(
+ "Should no longer contain all of the elements it started with",
+ !col.containsAll(org));
+ }
+
+ /**
+ * @tests java.util.AbstractCollection#isEmpty()
+ */
+ public void test_isEmpty() {
+ Collection col = new ArrayList();
+ assertTrue("Should be empty when created", col.isEmpty());
+ col.addAll(org);
+ assertTrue("Should not be empty", !col.isEmpty());
+ col.clear();
+ assertTrue("Should be empty after clear", col.isEmpty());
+ }
+
+ /**
+ * @tests java.util.AbstractCollection#removeAll(java.util.Collection)
+ */
+ public void test_removeAllLjava_util_Collection() {
+ Collection someCol = new HashSet(org);
+ Collection anotherCol = new HashSet(org);
+ anotherCol.remove(new Integer(5));
+ someCol.removeAll(anotherCol);
+ assertTrue("Collection is the wrong size--wanted 1, got: "
+ + someCol.size(), someCol.size() == 1);
+ someCol.remove(new Integer(5));
+ assertTrue("Collection is the wrong size--wanted 0, got: "
+ + someCol.size(), someCol.size() == 0);
+ }
+
+ /**
+ * @tests java.util.AbstractCollection#retainAll(java.util.Collection)
+ */
+ public void test_retainAllLjava_util_Collection() {
+ Collection someCol = new HashSet(org);
+ Collection anotherCol = new HashSet(org);
+ anotherCol.remove(new Integer(5));
+ someCol.retainAll(anotherCol);
+ assertTrue("Collection is the wrong size--wanted 99, got: "
+ + someCol.size(), someCol.size() == 99);
+ someCol.add(new Integer(5));
+ assertTrue("Collection is the wrong size--wanted 100, got: "
+ + someCol.size(), someCol.size() == 100);
+ }
+
+ /**
+ * @tests java.util.AbstractCollection#toArray()
+ */
+ public void test_toArray() {
+ Object[] objArray = org.toArray();
+ assertTrue("The returned array is the wrong length--wanted 100, got: "
+ + objArray.length, objArray.length == 100);
+ HashSet duplicates = new HashSet();
+ for (int i = objArray.length - 1; i >= 0; i--) {
+ assertTrue("The returned array has an incorrect value. At i = " + i
+ + " got: " + ((Integer) objArray[i]).intValue(), org
+ .contains(objArray[i]));
+ assertTrue("Duplicate found at i = " + i, !duplicates
+ .contains(objArray[i]));
+ duplicates.add(objArray[i]);
+ }
+ }
+
+ /**
+ * @tests java.util.AbstractCollection#toArray(java.lang.Object[])
+ */
+ public void test_toArray$Ljava_lang_Object() {
+ Object[] objArray = new Object[100];
+ org.toArray(objArray);
+ assertTrue(
+ "a) The returned array is the wrong length--wanted 100, got: "
+ + objArray.length, objArray.length == 100);
+ HashSet duplicates = new HashSet();
+ for (int i = objArray.length - 1; i >= 0; i--) {
+ assertTrue("a) The returned array has an incorrect value at i = "
+ + i, org.contains(objArray[i]));
+ assertTrue("Duplicate found at i = " + i, !duplicates
+ .contains(objArray[i]));
+ duplicates.add(objArray[i]);
+ }
+
+ Integer[] intArray = new Integer[105];
+ intArray[100] = new Integer(1203);
+ org.toArray(intArray);
+ assertTrue(
+ "b) The returned array is the wrong length--wanted 105, got: "
+ + intArray.length, intArray.length == 105);
+ duplicates = new HashSet();
+ for (int i = 99; i >= 0; i--) {
+ assertTrue("b) The returned array has an incorrect value at i = "
+ + i, org.contains(intArray[i]));
+ assertTrue("Duplicate found at i = " + i, !duplicates
+ .contains(intArray[i]));
+ duplicates.add(intArray[i]);
+ }
+ assertNull("End of list should be null", intArray[100]);
+
+ intArray = new Integer[1];
+ intArray = (Integer[]) org.toArray(intArray);
+ assertTrue(
+ "c) The returned array is the wrong length--wanted 100, got: "
+ + intArray.length, intArray.length == 100);
+ duplicates = new HashSet();
+ for (int i = intArray.length - 1; i >= 0; i--) {
+ assertTrue("c) The returned array has an incorrect value. At i = "
+ + i + " got: " + intArray[i].intValue(), org
+ .contains(intArray[i]));
+ assertTrue("Duplicate found at i = " + i, !duplicates
+ .contains(intArray[i]));
+ duplicates.add(intArray[i]);
+ }
+ }
+
+ protected void setUp() {
+ org = new HashSet();
+ for (int i = 0; i < 100; i++)
+ org.add(new Integer(i));
- }
+ }
- protected void tearDown() {
- }
+ protected void tearDown() {
+ }
}