You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ml...@apache.org on 2006/05/26 11:50:19 UTC
svn commit: r409615 - in
/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java:
net/URLDecoderTest.java util/ArrayListTest.java util/LinkedListTest.java
Author: mloenko
Date: Fri May 26 02:50:17 2006
New Revision: 409615
URL: http://svn.apache.org/viewvc?rev=409615&view=rev
Log:
tests clean-up
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLDecoderTest.java
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ArrayListTest.java
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/LinkedListTest.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLDecoderTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLDecoderTest.java?rev=409615&r1=409614&r2=409615&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLDecoderTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLDecoderTest.java Fri May 26 02:50:17 2006
@@ -24,63 +24,39 @@
public class URLDecoderTest extends junit.framework.TestCase {
/**
- * @tests java.net.URLDecoder#URLDecoder()
- */
- public void test_Constructor() {
- try {
- URLDecoder ud = new URLDecoder();
- assertNotNull("Constructor failed.", ud);
- } catch (Exception e) {
- fail("Constructor failed : " + e.getMessage());
- }
- }
+ * @tests java.net.URLDecoder#URLDecoder()
+ */
+ public void test_Constructor() throws Exception {
+ URLDecoder ud = new URLDecoder();
+ assertNotNull("Constructor failed.", ud);
+ }
/**
* @tests java.net.URLDecoder#decode(java.lang.String)
*/
- public void test_decodeLjava_lang_String() {
+ public void test_decodeLjava_lang_String() throws Exception {
// Test for method java.lang.String
// java.net.URLDecoder.decode(java.lang.String)
final String URL = "http://" + Support_Configuration.HomeAddress;
final String URL2 = "telnet://justWantToHaveFun.com:400";
- final String URL3 = "file://myServer.org/a file with spaces.jpg";
- try {
- assertTrue("1. Incorrect encoding/decoding", URLDecoder.decode(
- URLEncoder.encode(URL)).equals(URL));
- assertTrue("2. Incorrect encoding/decoding", URLDecoder.decode(
- URLEncoder.encode(URL2)).equals(URL2));
- assertTrue("3. Incorrect encoding/decoding", URLDecoder.decode(
- URLEncoder.encode(URL3)).equals(URL3));
- } catch (Exception e) {
- fail("Exception during test : " + e.getMessage());
- }
+ final String URL3 = "file://myServer.org/a file with spaces.jpg";
+ assertTrue("1. Incorrect encoding/decoding", URLDecoder.decode(
+ URLEncoder.encode(URL)).equals(URL));
+ assertTrue("2. Incorrect encoding/decoding", URLDecoder.decode(
+ URLEncoder.encode(URL2)).equals(URL2));
+ assertTrue("3. Incorrect encoding/decoding", URLDecoder.decode(
+ URLEncoder.encode(URL3)).equals(URL3));
}
/**
* @tests java.net.URLDecoder#decode(java.lang.String, java.lang.String)
*/
public void test_decodeLjava_lang_String_Ljava_lang_String() {
+ // Regression for HARMONY-467
try {
URLDecoder.decode("", "");
fail("UnsupportedEncodingException expected");
} catch (UnsupportedEncodingException e) {
- // expected
- } catch (Exception e) {
- assertEquals(UnsupportedEncodingException.class, e.getClass());
}
}
-
- /**
- * Sets up the fixture, for example, open a network connection. This method
- * is called before a test is executed.
- */
- protected void setUp() {
- }
-
- /**
- * Tears down the fixture, for example, close a network connection. This
- * method is called after a test is executed.
- */
- protected void tearDown() {
- }
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ArrayListTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ArrayListTest.java?rev=409615&r1=409614&r2=409615&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ArrayListTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ArrayListTest.java Fri May 26 02:50:17 2006
@@ -143,14 +143,12 @@
* @tests java.util.ArrayList#addAll(int, java.util.Collection)
*/
public void test_addAllILjava_util_Collection_2() {
+ // Regression for HARMONY-467
ArrayList obj = new ArrayList();
try {
obj.addAll((int) -1, (Collection) null);
fail("IndexOutOfBoundsException expected");
} catch (IndexOutOfBoundsException e) {
- // expected
- } catch (Exception e) {
- assertEquals(IndexOutOfBoundsException.class, e.getClass());
}
}
@@ -293,11 +291,9 @@
assertTrue("Returned incorrect element", alist.get(22) == objArray[22]);
try {
alist.get(8765);
+ fail("Failed to throw expected exception for index > size");
} catch (IndexOutOfBoundsException e) {
- // Correct
- return;
}
- fail("Failed to throw expected exception for index > size");
}
/**
@@ -350,15 +346,11 @@
alist.remove(10);
assertEquals("Failed to remove element",
-1, alist.indexOf(objArray[10]));
- boolean exception = false;
try {
alist.remove(999);
+ fail("Failed to throw exception when index out of range");
} catch (IndexOutOfBoundsException e) {
- // Correct
- exception = true;
}
- assertTrue("Failed to throw exception when index out of range",
- exception);
ArrayList myList = (ArrayList) (((ArrayList) (alist)).clone());
alist.add(25, null);
@@ -484,16 +476,10 @@
* Sets up the fixture, for example, open a network connection. This method
* is called before a test is executed.
*/
- protected void setUp() {
+ protected void setUp() throws Exception {
+ super.setUp();
alist = new ArrayList();
for (int i = 0; i < objArray.length; i++)
alist.add(objArray[i]);
- }
-
- /**
- * Tears down the fixture, for example, close a network connection. This
- * method is called after a test is executed.
- */
- protected void tearDown() {
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/LinkedListTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/LinkedListTest.java?rev=409615&r1=409614&r2=409615&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/LinkedListTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/LinkedListTest.java Fri May 26 02:50:17 2006
@@ -122,14 +122,12 @@
* @tests java.util.LinkedList#addAll(int, java.util.Collection)
*/
public void test_addAllILjava_util_Collection_2() {
+ // Regression for HARMONY-467
LinkedList obj = new LinkedList();
try {
- obj.addAll((int) -1, (Collection) null);
+ obj.addAll(-1, (Collection) null);
fail("IndexOutOfBoundsException expected");
} catch (IndexOutOfBoundsException e) {
- // expected
- } catch (Exception e) {
- assertEquals(IndexOutOfBoundsException.class, e.getClass());
}
}
@@ -243,11 +241,9 @@
assertTrue("Returned incorrect element", ll.get(22) == objArray[22]);
try {
ll.get(8765);
+ fail("Failed to throw expected exception for index > size");
} catch (IndexOutOfBoundsException e) {
- // Correct
- return;
}
- fail("Failed to throw expected exception for index > size");
}
/**
@@ -476,16 +472,11 @@
* Sets up the fixture, for example, open a network connection. This method
* is called before a test is executed.
*/
- protected void setUp() {
+ protected void setUp() throws Exception {
+ super.setUp();
ll = new LinkedList();
- for (int i = 0; i < objArray.length; i++)
+ for (int i = 0; i < objArray.length; i++) {
ll.add(objArray[i]);
- }
-
- /**
- * Tears down the fixture, for example, close a network connection. This
- * method is called after a test is executed.
- */
- protected void tearDown() {
+ }
}
}