示例#1
0
  @Test
  public void testErrorLog() throws IOException {
    String test = null;
    try {
      test.toString();
    } catch (Exception ex) {
      Debugger.logMessage(ex);
      String loggedMessage = "";
      FileReader reader = new FileReader(Debugger.getLogFilename());
      loggedMessage = reader.readFile();

      boolean containsExceptionInfo = loggedMessage.contains("null");
      assertTrue("Failure: the logged message did not contain \"null\"..", containsExceptionInfo);
    }
  }
示例#2
0
 @AfterClass
 public static void cleanup() {
   File logFile = new File(Debugger.getLogFilename());
   if (logFile.exists()) {
     logFile.delete();
   }
 }
示例#3
0
 @Test(expected = IllegalArgumentException.class)
 public void testNullLogArg() {
   Debugger.logMessage(null);
 }
示例#4
0
 @Test
 public void shouldDeleteLog() {
   Debugger.deleteLogFile();
   File logFile = new File(Debugger.getLogFilename());
   assertFalse("Failure: log file was still existent!", logFile.exists());
 }