Console implements Initializable { public Text formatLog(String level, String msg) { Text text = new Text(msg); text.getStyleClass().add("logger" + level); switch (level) { case "ERROR": text.setFill(Color.RED); break; case "WARN": text.setFill(Color.YELLOW); break; case "INFO": text.setFill(Color.CORAL); break; case "DEBUG": text.setFill(Color.GREEN); break; case "TRACE": text.setFill(Color.HONEYDEW); break; default: text.setFill(Color.WHITE); break; } return text; } Console(); static Console getInstance(); @Override void initialize(URL location, ResourceBundle resources); void attachGui(Stage gui); void close(); boolean show(); List<String> getCommandKeys(); @FXML void sendInput(ActionEvent event); void setInitText(); void printCommand(String command); void commandHelp(); void clear(); Boolean parseCommand(String input); void print(String input); void println(String input); String getConsoleOutputBuffer(); static boolean isLevel(String proposedLevel); static List<String> createLog(String level, String msg); void addLog(String level, String msg); List<String> getLog(String level); void clearLog(); void appendLog(List<String> log); Text formatLog(String level, String msg);  }
@Test public void testLogFormatter() { Console console = new Console(); Text testText = console.formatLog("ERROR", "testError"); Assert.assertEquals("testError", testText.getText()); testText = console.formatLog("WARN", "testWarn"); Assert.assertEquals("testWarn", testText.getText()); testText = console.formatLog("INFO", "testInfo"); Assert.assertEquals("testInfo", testText.getText()); testText = console.formatLog("DEBUG", "testDebug"); Assert.assertEquals("testDebug", testText.getText()); testText = console.formatLog("TRACE", "testTrace"); Assert.assertEquals("testTrace", testText.getText()); testText = console.formatLog("Not int Switch", "testSwitch"); Assert.assertEquals("testSwitch", testText.getText()); }