You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by py...@apache.org on 2006/08/23 11:07:37 UTC

svn commit: r433985 - /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/OutOfMemoryErrorTest.java

Author: pyang
Date: Wed Aug 23 02:07:36 2006
New Revision: 433985

URL: http://svn.apache.org/viewvc?rev=433985&view=rev
Log:
Remove the time killer which actually does not test OOME itself, add tests to test OOME constructors.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/OutOfMemoryErrorTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/OutOfMemoryErrorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/OutOfMemoryErrorTest.java?rev=433985&r1=433984&r2=433985&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/OutOfMemoryErrorTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/OutOfMemoryErrorTest.java Wed Aug 23 02:07:36 2006
@@ -1,4 +1,4 @@
-/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+/* Copyright 1998, 2006 The Apache Software Foundation or its licensors, as applicable
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,15 +22,9 @@
 	 */
 	public void test_Constructor() {
 		// Test for method java.lang.OutOfMemoryError()
-		try {
-			StringBuffer large[] = new StringBuffer[100000];
-
-			for (int i = 0; i < large.length; i++)
-				large[i] = new StringBuffer(1000000);
-		} catch (OutOfMemoryError e) {
-			return;
-		}
-		fail("No error generated");
+	    Error e = new OutOfMemoryError();
+        assertEquals(null, e.getCause());
+        assertEquals(null, e.getMessage());
 	}
 
 	/**
@@ -38,29 +32,13 @@
 	 */
 	public void test_ConstructorLjava_lang_String() {
 		// Test for method java.lang.OutOfMemoryError(java.lang.String)
-		try {
-			StringBuffer large[] = new StringBuffer[100000];
-
-			for (int i = 0; i < large.length; i++)
-				large[i] = new StringBuffer(1000000);
-		} catch (OutOfMemoryError e) {
-			return;
-		}
-		fail("No error generated");
+		Error e = new OutOfMemoryError(null);
+        assertEquals(null, e.getMessage());
+        assertEquals(null, e.getCause());
+        
+        e= new OutOfMemoryError("msg");
+        assertEquals("msg", e.getMessage());
+        assertEquals(null, e.getCause());
 	}
 
-	/**
-	 * 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() {
-		System.gc();
-	}
 }