Changeset 636 for trunk/java-utils-test
- Timestamp:
- 08/27/12 15:28:52 (12 years ago)
- Location:
- trunk/java-utils-test/src/test/java/de/ugoe/cs/util/console
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/java-utils-test/src/test/java/de/ugoe/cs/util/console/TextConsoleTest.java
r479 r636 3 3 import java.io.ByteArrayOutputStream; 4 4 import java.io.PrintStream; 5 import java.util.logging.Level; 5 6 6 7 import org.junit.*; … … 69 70 fixture.setDebug(true); 70 71 String traceMessage = "test"; 72 Level traceLevel = Level.WARNING; 73 String expectedMessage = "[WARNING] test"; 71 74 72 fixture.traceMsg(traceMessage );75 fixture.traceMsg(traceMessage, traceLevel); 73 76 74 assertEquals( traceMessage, outContent.toString());77 assertEquals(expectedMessage, outContent.toString()); 75 78 } 76 79 … … 78 81 public void testTraceMsg_2() throws Exception { 79 82 TextConsole fixture = new TextConsole(); 80 fixture.setDebug( false);83 fixture.setDebug(true); 81 84 String traceMessage = "test"; 85 Level traceLevel = Level.INFO; 86 String expectedMessage = "[INFO] test"; 82 87 83 fixture.traceMsg(traceMessage );88 fixture.traceMsg(traceMessage, traceLevel); 84 89 85 assertEquals( "", outContent.toString());90 assertEquals(expectedMessage, outContent.toString()); 86 91 } 92 93 @Test 94 public void testTraceMsg_3() throws Exception { 95 TextConsole fixture = new TextConsole(); 96 fixture.setDebug(false); 97 String traceMessage = "[INFO] test"; 98 Level traceLevel = Level.INFO; 99 100 101 fixture.traceMsg(traceMessage, traceLevel); 102 103 assertEquals("", outContent.toString()); 104 } 87 105 88 106 @Before -
trunk/java-utils-test/src/test/java/de/ugoe/cs/util/console/mock/MockObserver.java
r479 r636 1 1 package de.ugoe.cs.util.console.mock; 2 3 import java.util.logging.Level; 2 4 3 5 import de.ugoe.cs.util.console.ConsoleObserver; … … 19 21 } 20 22 @Override 21 public void traceMsg(String traceMessage ) {23 public void traceMsg(String traceMessage, Level level) { 22 24 } 23 25 } -
trunk/java-utils-test/src/test/java/de/ugoe/cs/util/console/mock/MockTraceListener.java
r479 r636 1 1 package de.ugoe.cs.util.console.mock; 2 3 import java.util.logging.Level; 2 4 3 5 import de.ugoe.cs.util.console.listener.ITraceListener; … … 5 7 public class MockTraceListener implements ITraceListener { 6 8 private String lastTrace = null; 9 private Level lastLevel = null; 7 10 public String getLastTrace() { 8 11 return lastTrace; 9 12 } 13 14 public Level getLastLevel() { 15 return lastLevel; 16 } 17 10 18 @Override 11 public void traceMsg(String traceMessage ) {19 public void traceMsg(String traceMessage, Level level) { 12 20 lastTrace = traceMessage; 13 21 }
Note: See TracChangeset
for help on using the changeset viewer.