@Test public void getErrorMessage() { logView = new LogView(); logView.open(); List<LogMessage> messages = logView.getErrorMessages(); assertTrue("No ERROR messages found!", !messages.isEmpty()); // test ERROR Message no.1 assertTrue( messageIsAvailable(messages, IStatus.ERROR, ERROR_ID_1, ERROR_MESSAGE_1, ERROR_STACK_1)); // test ERROR Message no.2 assertTrue( messageIsAvailable(messages, IStatus.ERROR, ERROR_ID_2, ERROR_MESSAGE_2, ERROR_STACK_2)); }
protected void checkErrorLog(Quickstart qstart) { List<LogMessage> allErrors = new ArrayList<LogMessage>(); List<LogMessage> errors = errorLogView.getErrorMessages(); String errorMessages = ""; for (LogMessage message : errors) { if (!message.getMessage().contains("Unable to delete") && !message.getMessage().contains("Could not delete")) { reporter.addError(qstart, "ERROR IN ERROR LOG: " + message.getMessage()); errorMessages += "\t" + message.getMessage() + "\n"; } } errorLogView.deleteLog(); if (!allErrors.isEmpty()) { fail("There are errors in error log:\n" + errorMessages); } }
@Test public void getWarningMessage() { logView = new LogView(); logView.open(); List<LogMessage> messages = logView.getWarningMessages(); assertTrue("No WARNING messages found!", !messages.isEmpty()); // test WARNING Message no.1 assertTrue( messageIsAvailable( messages, IStatus.WARNING, WARNING_ID_1, WARNING_MESSAGE_1, WARNING_STACK_1)); // test WARNING Message no.2 assertTrue( messageIsAvailable( messages, IStatus.WARNING, WARNING_ID_2, WARNING_MESSAGE_2, WARNING_STACK_2)); }
@Test public void getOKMessage() { logView = new LogView(); logView.open(); List<LogMessage> messages = logView.getOKMessages(); assertTrue("No OK messages found!", !messages.isEmpty()); // test OK Message no.1 assertTrue( messageIsAvailable( messages, IStatus.OK, OK_ID_1, OK_MESSAGE_1, "An exception stack trace is not available.")); // test OK Message no.2 assertTrue(messageIsAvailable(messages, IStatus.OK, OK_ID_2, OK_MESSAGE_2, OK_STACK_2)); }
@Test public void testDelete() { logView = new LogView(); logView.open(); assertFalse("There must be messages", logView.getErrorMessages().isEmpty()); logView.deleteLog(); assertTrue("There should be no messages", logView.getErrorMessages().isEmpty()); logView.restoreLog(); assertTrue("There should be no messages", logView.getErrorMessages().isEmpty()); }
@Test public void testClearAndRestore() { logView = new LogView(); logView.open(); assertFalse("There must be messages", logView.getErrorMessages().isEmpty()); logView.clearLog(); assertFalse("There should be messages", logView.getErrorMessages().isEmpty()); logView.restoreLog(); assertFalse("There should be messages", logView.getErrorMessages().isEmpty()); }
protected static void setupLog() { errorLogView = new LogView(); errorLogView.open(); errorLogView.deleteLog(); }