harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r470766 - /incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/StreamHandlerTest.java
Date Fri, 03 Nov 2006 11:45:40 GMT
Author: smishura
Date: Fri Nov  3 03:45:39 2006
New Revision: 470766

URL: http://svn.apache.org/viewvc?view=rev&rev=470766
Log:
Apply patch for HARMONY-2048 ([classlib][logging]fix some testcases in org.apache.harmony.logging.tests.java.util.logging.StreamHandlerTest.java
to follow JUnit Best Practice)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/StreamHandlerTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/StreamHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/StreamHandlerTest.java?view=diff&rev=470766&r1=470765&r2=470766
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/StreamHandlerTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/StreamHandlerTest.java
Fri Nov  3 03:45:39 2006
@@ -100,10 +100,10 @@
 				"java.util.logging.StreamHandler.encoding"));
 
 		StreamHandler h = new StreamHandler();
-		assertSame(h.getLevel(), Level.INFO);
+		assertSame(Level.INFO, h.getLevel());
 		assertTrue(h.getFormatter() instanceof SimpleFormatter);
 		assertNull(h.getFilter());
-		assertSame(h.getEncoding(), null);
+		assertNull(h.getEncoding());
 	}
 
 	/*
@@ -124,10 +124,10 @@
 		// set a normal value
 		try {
 			StreamHandler h = new StreamHandler();
-			assertSame(h.getLevel(), Level.INFO);
+			assertSame(Level.INFO, h.getLevel());
 			assertTrue(h.getFormatter() instanceof SimpleFormatter);
 			assertNull(h.getFilter());
-			assertSame(h.getEncoding(), null);
+			assertNull(h.getEncoding());
 		} finally {
 			System.setSecurityManager(oldMan);
 		}
@@ -148,15 +148,15 @@
 		LogManager.getLogManager().readConfiguration(
 				EnvironmentHelper.PropertiesToInputStream(p));
 
-		assertEquals(LogManager.getLogManager().getProperty(
-				"java.util.logging.StreamHandler.level"), "FINE");
-		assertEquals(LogManager.getLogManager().getProperty(
-				"java.util.logging.StreamHandler.encoding"), "iso-8859-1");
+		assertEquals("FINE", LogManager.getLogManager().getProperty(
+				"java.util.logging.StreamHandler.level"));
+		assertEquals("iso-8859-1", LogManager.getLogManager().getProperty(
+				"java.util.logging.StreamHandler.encoding"));
 		StreamHandler h = new StreamHandler();
 		assertSame(h.getLevel(), Level.parse("FINE"));
 		assertTrue(h.getFormatter() instanceof MockFormatter);
 		assertTrue(h.getFilter() instanceof MockFilter);
-		assertEquals(h.getEncoding(), "iso-8859-1");
+		assertEquals("iso-8859-1", h.getEncoding());
 	}
 
 	/*
@@ -173,12 +173,12 @@
 		LogManager.getLogManager().readConfiguration(
 				EnvironmentHelper.PropertiesToInputStream(p));
 
-		assertEquals(LogManager.getLogManager().getProperty(
-				"java.util.logging.StreamHandler.level"), INVALID_LEVEL);
-		assertEquals(LogManager.getLogManager().getProperty(
-				"java.util.logging.StreamHandler.encoding"), "XXXX");
+		assertEquals(INVALID_LEVEL, LogManager.getLogManager().getProperty(
+				"java.util.logging.StreamHandler.level"));
+		assertEquals("XXXX", LogManager.getLogManager().getProperty(
+				"java.util.logging.StreamHandler.encoding"));
 		StreamHandler h = new StreamHandler();
-		assertSame(h.getLevel(), Level.INFO);
+		assertSame(Level.INFO, h.getLevel());
 		assertTrue(h.getFormatter() instanceof SimpleFormatter);
 		assertNull(h.getFilter());
 		assertNull(h.getEncoding());
@@ -203,10 +203,10 @@
 
 		StreamHandler h = new StreamHandler(new ByteArrayOutputStream(),
 				new MockFormatter2());
-		assertSame(h.getLevel(), Level.INFO);
+		assertSame(Level.INFO, h.getLevel());
 		assertTrue(h.getFormatter() instanceof MockFormatter2);
 		assertNull(h.getFilter());
-		assertSame(h.getEncoding(), null);
+		assertNull(h.getEncoding());
 	}
 
 	/*
@@ -228,10 +228,10 @@
 		try {
 			StreamHandler h = new StreamHandler(new ByteArrayOutputStream(),
 					new MockFormatter2());
-			assertSame(h.getLevel(), Level.INFO);
+			assertSame(Level.INFO, h.getLevel());
 			assertTrue(h.getFormatter() instanceof MockFormatter2);
 			assertNull(h.getFilter());
-			assertSame(h.getEncoding(), null);
+			assertNull(h.getEncoding());
 		} finally {
 			System.setSecurityManager(oldMan);
 		}
@@ -253,16 +253,16 @@
 		LogManager.getLogManager().readConfiguration(
 				EnvironmentHelper.PropertiesToInputStream(p));
 
-		assertEquals(LogManager.getLogManager().getProperty(
-				"java.util.logging.StreamHandler.level"), "FINE");
-		assertEquals(LogManager.getLogManager().getProperty(
-				"java.util.logging.StreamHandler.encoding"), "iso-8859-1");
+		assertEquals("FINE", LogManager.getLogManager().getProperty(
+				"java.util.logging.StreamHandler.level"));
+		assertEquals("iso-8859-1", LogManager.getLogManager().getProperty(
+				"java.util.logging.StreamHandler.encoding"));
 		StreamHandler h = new StreamHandler(new ByteArrayOutputStream(),
 				new MockFormatter2());
 		assertSame(h.getLevel(), Level.parse("FINE"));
 		assertTrue(h.getFormatter() instanceof MockFormatter2);
 		assertTrue(h.getFilter() instanceof MockFilter);
-		assertEquals(h.getEncoding(), "iso-8859-1");
+		assertEquals("iso-8859-1", h.getEncoding());
 	}
 
 	/*
@@ -279,13 +279,13 @@
 		LogManager.getLogManager().readConfiguration(
 				EnvironmentHelper.PropertiesToInputStream(p));
 
-		assertEquals(LogManager.getLogManager().getProperty(
-				"java.util.logging.StreamHandler.level"), INVALID_LEVEL);
-		assertEquals(LogManager.getLogManager().getProperty(
-				"java.util.logging.StreamHandler.encoding"), "XXXX");
+		assertEquals(INVALID_LEVEL, LogManager.getLogManager().getProperty(
+				"java.util.logging.StreamHandler.level"));
+		assertEquals("XXXX", LogManager.getLogManager().getProperty(
+				"java.util.logging.StreamHandler.encoding"));
 		StreamHandler h = new StreamHandler(new ByteArrayOutputStream(),
 				new MockFormatter2());
-		assertSame(h.getLevel(), Level.INFO);
+		assertSame(Level.INFO, h.getLevel());
 		assertTrue(h.getFormatter() instanceof MockFormatter2);
 		assertNull(h.getFilter());
 		assertNull(h.getEncoding());
@@ -307,14 +307,15 @@
 		LogManager.getLogManager().readConfiguration(
 				EnvironmentHelper.PropertiesToInputStream(p));
 
-		assertEquals(LogManager.getLogManager().getProperty(
-				"java.util.logging.StreamHandler.level"), "FINE");
-		assertEquals(LogManager.getLogManager().getProperty(
-				"java.util.logging.StreamHandler.encoding"), "iso-8859-1");
+		assertEquals("FINE", LogManager.getLogManager().getProperty(
+				"java.util.logging.StreamHandler.level"));
+		assertEquals("iso-8859-1", LogManager.getLogManager().getProperty(
+				"java.util.logging.StreamHandler.encoding"));
 		try {
 			new StreamHandler(new ByteArrayOutputStream(), null);
 			fail("Should throw NullPointerException!");
 		} catch (NullPointerException e) {
+			// expected
 		}
 	}
 
@@ -334,14 +335,15 @@
 		LogManager.getLogManager().readConfiguration(
 				EnvironmentHelper.PropertiesToInputStream(p));
 
-		assertEquals(LogManager.getLogManager().getProperty(
-				"java.util.logging.StreamHandler.level"), "FINE");
-		assertEquals(LogManager.getLogManager().getProperty(
-				"java.util.logging.StreamHandler.encoding"), "iso-8859-1");
+		assertEquals("FINE", LogManager.getLogManager().getProperty(
+				"java.util.logging.StreamHandler.level"));
+		assertEquals("iso-8859-1", LogManager.getLogManager().getProperty(
+				"java.util.logging.StreamHandler.encoding"));
 		try {
 			new StreamHandler(null, new MockFormatter2());
 			fail("Should throw NullPointerException!");
 		} catch (NullPointerException e) {
+			// expected
 		}
 	}
 
@@ -408,6 +410,7 @@
 			h.close();
 			fail("Should throw SecurityException!");
 		} catch (SecurityException e) {
+			// expected
 		} finally {
 			System.setSecurityManager(oldMan);
 		}
@@ -751,6 +754,7 @@
 			h.setEncoding("impossible");
 			fail("Should throw UnsupportedEncodingException!");
 		} catch (UnsupportedEncodingException e) {
+			// expected
 		}
 		assertNull(h.getEncoding());
 	}
@@ -767,6 +771,7 @@
 			h.setEncoding("iso-8859-1");
 			fail("Should throw SecurityException!");
 		} catch (SecurityException e) {
+			// expected
 		} finally {
 			System.setSecurityManager(oldMan);
 		}
@@ -778,6 +783,7 @@
 			h.setEncoding("impossible");
 			fail("Should throw SecurityException!");
 		} catch (SecurityException e) {
+			// expected
 		} finally {
 			System.setSecurityManager(oldMan);
 		}
@@ -807,6 +813,7 @@
 			h.setOutputStream(null);
 			fail("Should throw NullPointerException!");
 		} catch (NullPointerException e) {
+			// expected
 		}
 	}
 
@@ -883,6 +890,7 @@
 			h.setOutputStream(new ByteArrayOutputStream());
 			fail("Should throw SecurityException!");
 		} catch (SecurityException e) {
+			// expected
 		} finally {
 			System.setSecurityManager(oldMan);
 		}
@@ -893,6 +901,7 @@
 			h.setOutputStream(null);
 			fail("Should throw NullPointerException!");
 		} catch (NullPointerException e) {
+			// expected
 		} finally {
 			System.setSecurityManager(oldMan);
 		}



Mime
View raw message