You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2006/06/07 20:27:51 UTC
svn commit: r412479 - in
/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java:
org/apache/harmony/tests/java/lang/EnumTest.java
tests/api/java/net/ProxyTest.java
Author: tellison
Date: Wed Jun 7 11:27:50 2006
New Revision: 412479
URL: http://svn.apache.org/viewvc?rev=412479&view=rev
Log:
Make enum tests tollerant of different compiler idioms.
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/lang/EnumTest.java
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/ProxyTest.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/lang/EnumTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/lang/EnumTest.java?rev=412479&r1=412478&r2=412479&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/lang/EnumTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/lang/EnumTest.java Wed Jun 7 11:27:50 2006
@@ -105,15 +105,18 @@
assertSame(moe, Sample.valueOf("MOE"));
try {
Sample.valueOf("non-existant");
- fail("Expected IllegalArgumentException");
+ fail("Expected an exception");
} catch (IllegalArgumentException e){
// Expected
}
try {
Sample.valueOf(null);
} catch (NullPointerException e) {
- // expected
+ // May be caused by some compilers' code
+ } catch (IllegalArgumentException e) {
+ // other compilers will throw this
}
+
Sample s = Enum.valueOf(Sample.class, "CURLY");
assertSame(s, Sample.CURLY);
@@ -129,21 +132,27 @@
}
try {
Enum.valueOf((Class<Sample>)null, "a string");
- fail("Expected NullPointerException");
+ fail("Expected an exception");
} catch (NullPointerException e) {
- // Expected
+ // May be caused by some compilers' code
+ } catch (IllegalArgumentException e) {
+ // other compilers will throw this
}
try {
Enum.valueOf(Sample.class, null);
- fail("Expected IllegalArgumentException");
+ fail("Expected an exception");
} catch (NullPointerException e) {
- // Expected
+ // May be caused by some compilers' code
+ } catch (IllegalArgumentException e) {
+ // other compilers will throw this
}
try {
Enum.valueOf((Class<Sample>)null, (String)null);
- fail("Expected IllegalArgumentException");
+ fail("Expected an exception");
} catch (NullPointerException e) {
- // Expected
+ // May be caused by some compilers' code
+ } catch (IllegalArgumentException e) {
+ // other compilers will throw this
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/ProxyTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/ProxyTest.java?rev=412479&r1=412478&r2=412479&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/ProxyTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/ProxyTest.java Wed Jun 7 11:27:50 2006
@@ -206,14 +206,16 @@
* @tests java.net.Proxy.Type#valueOf(String)
*/
public void test_Type_valueOfLjava_lang_String_NullPointerException() {
- // Some old RIs,which throw IllegalArgumentException, will fail
- // this test case. Latest RIs throw NullPointerException.
+ // Some old RIs,which throw IllegalArgumentException.
+ // Latest RIs throw NullPointerException.
try {
Proxy.Type.valueOf(null);
- fail("should throw NullPointerException.");
- } catch (NullPointerException e) {
- // expected
- }
+ fail("should throw an exception.");
+ } catch (NullPointerException e) {
+ // May be caused by some compilers' code
+ } catch (IllegalArgumentException e) {
+ // other compilers will throw this
+ }
}
/**