- Timestamp:
- 08/27/12 15:34:21 (12 years ago)
- Location:
- trunk/java-utils-test/src/test/java/de/ugoe/cs/util/console
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/java-utils-test/src/test/java/de/ugoe/cs/util/console/ConsoleTest.java
r479 r638 1 1 package de.ugoe.cs.util.console; 2 3 import java.util.logging.Level; 2 4 3 5 import org.junit.*; … … 317 319 } 318 320 319 @Test 321 @SuppressWarnings("deprecation") 322 @Test 320 323 public void testTrace_1() 321 324 throws Exception { … … 331 334 332 335 assertEquals(traceMsg, mockTraceListener1.getLastTrace()); 336 assertEquals(Level.INFO, mockTraceListener1.getLastLevel()); 333 337 assertEquals(traceMsg, mockTraceListener2.getLastTrace()); 338 assertEquals(Level.INFO, mockTraceListener2.getLastLevel()); 334 339 } 335 340 336 @Test 341 @Test 342 public void testTrace_2() 343 throws Exception { 344 String traceMsg = "test"; 345 Level traceLevel = Level.SEVERE; 346 347 MockTraceListener mockTraceListener1 = new MockTraceListener(); 348 MockTraceListener mockTraceListener2 = new MockTraceListener(); 349 350 Console.getInstance().registerTraceListener(mockTraceListener1); 351 Console.getInstance().registerTraceListener(mockTraceListener2); 352 353 Console.trace(traceLevel, traceMsg); 354 355 assertEquals(traceMsg, mockTraceListener1.getLastTrace()); 356 assertEquals(traceLevel, mockTraceListener1.getLastLevel()); 357 assertEquals(traceMsg, mockTraceListener2.getLastTrace()); 358 assertEquals(traceLevel, mockTraceListener2.getLastLevel()); 359 } 360 361 @SuppressWarnings("deprecation") 362 @Test 337 363 public void testTraceln_1() 338 364 throws Exception { … … 348 374 349 375 assertEquals(traceMsg+ENDLINE, mockTraceListener1.getLastTrace()); 376 assertEquals(Level.INFO, mockTraceListener1.getLastLevel()); 350 377 assertEquals(traceMsg+ENDLINE, mockTraceListener2.getLastTrace()); 351 352 // add additional test code here 353 } 378 assertEquals(Level.INFO, mockTraceListener1.getLastLevel()); 379 } 380 381 @Test 382 public void testTraceln_2() 383 throws Exception { 384 String traceMsg = "test"; 385 Level traceLevel = Level.SEVERE; 386 387 MockTraceListener mockTraceListener1 = new MockTraceListener(); 388 MockTraceListener mockTraceListener2 = new MockTraceListener(); 389 390 Console.getInstance().registerTraceListener(mockTraceListener1); 391 Console.getInstance().registerTraceListener(mockTraceListener2); 392 393 Console.traceln(traceLevel, traceMsg); 394 395 assertEquals(traceMsg+ENDLINE, mockTraceListener1.getLastTrace()); 396 assertEquals(traceLevel, mockTraceListener1.getLastLevel()); 397 assertEquals(traceMsg+ENDLINE, mockTraceListener2.getLastTrace()); 398 assertEquals(traceLevel, mockTraceListener2.getLastLevel()); 399 } 354 400 355 401 @Before -
trunk/java-utils-test/src/test/java/de/ugoe/cs/util/console/mock/MockTraceListener.java
r636 r638 19 19 public void traceMsg(String traceMessage, Level level) { 20 20 lastTrace = traceMessage; 21 lastLevel = level; 21 22 } 22 23 }
Note: See TracChangeset
for help on using the changeset viewer.