You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by od...@apache.org on 2007/10/25 16:34:09 UTC
svn commit: r588241 -
/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/
Author: odeakin
Date: Thu Oct 25 07:34:08 2007
New Revision: 588241
URL: http://svn.apache.org/viewvc?rev=588241&view=rev
Log:
Let JUnit deal with unexpected Exceptions rather than catching them ourselves.
Modified:
harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/BidiTest.java
harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DateFormatSymbolsTest.java
harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java
harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java
harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ParsePositionTest.java
harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java
Modified: harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/BidiTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/BidiTest.java?rev=588241&r1=588240&r2=588241&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/BidiTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/BidiTest.java Thu Oct 25 07:34:08 2007
@@ -968,8 +968,6 @@
} catch (IllegalArgumentException e) {
// Expected for illegal run limit
return;
- } catch (Exception e) {
- fail("Unexpected exception: " + e);
}
fail("Expected IllegalArgumentException to be thrown for invalid run limit");
@@ -983,8 +981,6 @@
} catch (IllegalArgumentException e) {
// Expected for illegal run limit
return;
- } catch (Exception e) {
- fail("Unexpected exception: " + e);
}
fail("Expected IllegalArgumentException to be thrown for invalid run limit");
Modified: harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DateFormatSymbolsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DateFormatSymbolsTest.java?rev=588241&r1=588240&r2=588241&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DateFormatSymbolsTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DateFormatSymbolsTest.java Thu Oct 25 07:34:08 2007
@@ -30,11 +30,7 @@
public void test_Constructor() {
// Test for method java.text.DateFormatSymbols()
// Used in tests
- try {
- new DateFormatSymbols();
- } catch (Exception e) {
- fail("Constructor failed.");
- }
+ new DateFormatSymbols();
}
/**
@@ -42,11 +38,7 @@
*/
public void test_ConstructorLjava_util_Locale() {
// Test for method java.text.DateFormatSymbols(java.util.Locale)
- try {
- new DateFormatSymbols(new Locale("en", "us"));
- } catch (Exception e) {
- fail("Constructor failed.");
- }
+ new DateFormatSymbols(new Locale("en", "us"));
}
/**
Modified: harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java?rev=588241&r1=588240&r2=588241&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java Thu Oct 25 07:34:08 2007
@@ -1504,7 +1504,7 @@
/**
* @tests serialization compatibility with RI
*/
- public void test_serializationHarmonyRICompatible() {
+ public void test_serializationHarmonyRICompatible() throws Exception {
NumberFormat nf = NumberFormat.getInstance(Locale.FRANCE);
DecimalFormat df = null;
@@ -1522,8 +1522,6 @@
oinput = new ObjectInputStream(this.getClass().getResource(
"/serialization/java/text/DecimalFormat.ser").openStream());
deserializedDF = (DecimalFormat) oinput.readObject();
- } catch (Exception e) {
- fail("Error occurs during deserialization");
} finally {
try {
if (null != oinput) {
@@ -1594,11 +1592,7 @@
*/
public void testSetDecimalFormatSymbolsAsNull(){
// Regression for HARMONY-1070
- try {
- DecimalFormat format = (DecimalFormat)DecimalFormat.getInstance();
- format.setDecimalFormatSymbols(null);
- } catch (Exception e) {
- fail("Unexpected exception caught: " + e);
- }
+ DecimalFormat format = (DecimalFormat)DecimalFormat.getInstance();
+ format.setDecimalFormatSymbols(null);
}
}
Modified: harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java?rev=588241&r1=588240&r2=588241&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java Thu Oct 25 07:34:08 2007
@@ -128,22 +128,15 @@
assertEquals("Simple string", "Test message", new MessageFormat("Test message").format(
new Object[0]));
- try {
- result = new MessageFormat("Don't").format(new Object[0]);
- assertTrue("Should not throw IllegalArgumentException: " + result,
+ result = new MessageFormat("Don't").format(new Object[0]);
+ assertTrue("Should not throw IllegalArgumentException: " + result,
"Dont".equals(result));
- } catch (Exception e) {
- fail("Unexpected exception: " + e);
- }
try {
new MessageFormat("Invalid {1,foobar} format descriptor!");
fail("Expected test_ConstructorLjava_lang_String to throw IAE.");
} catch (IllegalArgumentException ex) {
// expected
- } catch (Throwable ex) {
- fail("Expected test_ConstructorLjava_lang_String to throw IAE, not a "
- + ex.getClass().getName());
}
try {
@@ -151,9 +144,6 @@
"Invalid {1,date,invalid-spec} format descriptor!");
} catch (IllegalArgumentException ex) {
// expected
- } catch (Throwable ex) {
- fail("Expected test_ConstructorLjava_lang_String to throw IAE, not a "
- + ex.getClass().getName());
}
checkSerialization(new MessageFormat(""));
Modified: harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ParsePositionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ParsePositionTest.java?rev=588241&r1=588240&r2=588241&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ParsePositionTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ParsePositionTest.java Thu Oct 25 07:34:08 2007
@@ -22,21 +22,15 @@
ParsePosition pp;
- /**
- * @tests java.text.ParsePosition#ParsePosition(int)
- */
- public void test_ConstructorI() {
- // Test for method java.text.ParsePosition(int)
- try {
- ParsePosition pp1 = new ParsePosition(Integer.MIN_VALUE);
- assertTrue("Initialization failed.",
- pp1.getIndex() == Integer.MIN_VALUE);
- assertEquals("Initialization failed.", -1, pp1.getErrorIndex());
- } catch (Exception e) {
- fail("Constructor failed.");
- }
-
- }
+ /**
+ * @tests java.text.ParsePosition#ParsePosition(int)
+ */
+ public void test_ConstructorI() {
+ // Test for method java.text.ParsePosition(int)
+ ParsePosition pp1 = new ParsePosition(Integer.MIN_VALUE);
+ assertTrue("Initialization failed.", pp1.getIndex() == Integer.MIN_VALUE);
+ assertEquals("Initialization failed.", -1, pp1.getErrorIndex());
+ }
/**
* @tests java.text.ParsePosition#equals(java.lang.Object)
Modified: harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java?rev=588241&r1=588240&r2=588241&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java Thu Oct 25 07:34:08 2007
@@ -141,10 +141,7 @@
fail("Expected test_ConstructorLjava_lang_String to throw IAE.");
} catch (IllegalArgumentException ex) {
// expected
- } catch (Throwable ex) {
- fail("Expected test_ConstructorLjava_lang_String to throw IAE, not "
- + ex.getClass().getName());
- }
+ }
// Null string value
try {
@@ -152,10 +149,7 @@
fail("Expected test_ConstructorLjava_lang_String to throw NPE.");
} catch (NullPointerException ex) {
// expected
- } catch (Throwable ex) {
- fail("Expected test_ConstructorLjava_lang_String to throw NPE, not "
- + ex.getClass().getName());
- }
+ }
}
/**
@@ -504,9 +498,7 @@
fail("Expected test to throw NPE.");
} catch (NullPointerException ex) {
// expected
- } catch (Throwable ex) {
- fail("Expected test to throw NPE, not " + ex.getClass().getName());
- }
+ }
}
/**