[LOGBack-dev] svn commit: r271 - logback/core/trunk/src/test/java/ch/qos/logback/core/status

noreply.seb at qos.ch noreply.seb at qos.ch
Tue Jul 25 11:56:30 CEST 2006


Author: seb
Date: Tue Jul 25 11:56:30 2006
New Revision: 271

Added:
   logback/core/trunk/src/test/java/ch/qos/logback/core/status/StatusBaseTest.java
Log:
initial commit

Added: logback/core/trunk/src/test/java/ch/qos/logback/core/status/StatusBaseTest.java
==============================================================================
--- (empty file)
+++ logback/core/trunk/src/test/java/ch/qos/logback/core/status/StatusBaseTest.java	Tue Jul 25 11:56:30 2006
@@ -0,0 +1,51 @@
+package ch.qos.logback.core.status;
+
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+public class StatusBaseTest extends TestCase {
+
+	public void testAddStatus() {
+		{
+			InfoStatus status = new InfoStatus("testing", this);
+			status.add(new ErrorStatus("error", this));
+			Iterator it = status.iterator();
+			assertTrue("No status was added", it.hasNext());
+			assertTrue("hasChilden method reported wrong result", status
+					.hasChildren());
+		}
+		{
+			InfoStatus status = new InfoStatus("testing", this);
+			boolean thrown = false;
+			try {
+				status.add(null);
+			} catch (NullPointerException ex) {
+				thrown = true;
+			}
+			assertTrue("Exception was not thrown", thrown);
+		}
+	}
+
+	public void testRemoveStatus() {
+		{
+			InfoStatus status = new InfoStatus("testing", this);
+			ErrorStatus error = new ErrorStatus("error", this);
+			status.add(error);
+			boolean result = status.remove(error);
+			Iterator it = status.iterator();
+			assertTrue("Remove failed", result);
+			assertFalse("No status was removed", it.hasNext());
+			assertFalse("hasChilden method reported wrong result", status
+					.hasChildren());
+		}
+		{
+			InfoStatus status = new InfoStatus("testing", this);
+			ErrorStatus error = new ErrorStatus("error", this);
+			status.add(error);
+			boolean result = status.remove(null);
+			assertFalse("Remove result was not false", result);
+		}
+	}
+
+}



More information about the logback-dev mailing list