Skip to content
Permalink
Browse files
Test case for [JENKINS-22360]
  • Loading branch information
kutzi committed Mar 28, 2014
1 parent ee9e924 commit abb2a3f84c120c89a22f7bcdd632031d32cfe68b
Showing with 20 additions and 9 deletions.
  1. +0 −9 src/main/java/hudson/plugins/ircbot/v2/IRCColorizer.java
  2. +20 −0 src/test/java/hudson/plugins/ircbot/v2/IRCColorizerTest.java
@@ -26,17 +26,8 @@ public class IRCColorizer {
*/
public static String colorize(String message){

// TODO: use ResultTrend.getID() instead of magic keyword strings!

if(message.contains("Starting ")) {
return message;
// if (message.contains("STILL FAILING")) {
// foreground = Colors.RED;
// } else if (message.contains("FAILURE")) {
// foreground = Colors.BOLD + Colors.RED;
// } else {
// foreground = Colors.DARK_GREEN;
// }
} else {
String line = colorForBuildResult(message);
if (line == message) { // line didn't contain a build result
@@ -0,0 +1,20 @@
package hudson.plugins.ircbot.v2;

import static org.junit.Assert.assertEquals;

import org.junit.Test;
import org.jvnet.hudson.test.Bug;
import org.pircbotx.Colors;

public class IRCColorizerTest {

@Test
@Bug(22360)
public void shouldColorizeKeywords() {
String message = "Build job123 is STILL FAILING: https://server.com/build/42";
String colorizedMessage = IRCColorizer.colorize(message);

assertEquals("Build job123 is " + Colors.BOLD + Colors.RED + "STILL FAILING" + Colors.NORMAL + ": https://server.com/build/42", colorizedMessage);
}

}

0 comments on commit abb2a3f

Please sign in to comment.