From d432033a76cc22b05fa494fb3217c0d1af224a77 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Tue, 2 Jun 2020 11:00:36 +0100 Subject: [PATCH] JAL-3446 fix broken test --- src/jalview/util/ColorUtils.java | 6 +----- test/jalview/util/ColorUtilsTest.java | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/jalview/util/ColorUtils.java b/src/jalview/util/ColorUtils.java index c1feeee..4305f59 100644 --- a/src/jalview/util/ColorUtils.java +++ b/src/jalview/util/ColorUtils.java @@ -219,7 +219,7 @@ public class ColorUtils colour = colour.trim(); Color col = null; - if (colour.length() == 6 && StringUtils.isHexString(colour)) + if (StringUtils.isHexString(colour)) { try { @@ -255,10 +255,6 @@ public class ColorUtils return col; } - - public static boolean couldBeHexColor(String n) { - return (n.length() > 0 && "abcdefABCDEF".indexOf(n.charAt(0)) >= 0); - } /** * Constructs a colour from a text string. The hashcode of the whole string is diff --git a/test/jalview/util/ColorUtilsTest.java b/test/jalview/util/ColorUtilsTest.java index fa4091f..9d9482c 100644 --- a/test/jalview/util/ColorUtilsTest.java +++ b/test/jalview/util/ColorUtilsTest.java @@ -24,13 +24,13 @@ import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertNull; import static org.testng.AssertJUnit.assertSame; -import jalview.gui.JvOptionPane; - import java.awt.Color; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; +import jalview.gui.JvOptionPane; + public class ColorUtilsTest { @@ -206,7 +206,7 @@ public class ColorUtilsTest */ assertNull(ColorUtils.parseColourString(null)); assertNull(ColorUtils.parseColourString("rubbish")); - assertEquals(Color.WHITE, ColorUtils.parseColourString("-1")); + assertNull(ColorUtils.parseColourString("-1")); assertNull(ColorUtils.parseColourString(String .valueOf(Integer.MAX_VALUE))); assertNull(ColorUtils.parseColourString("100,200,300")); // out of range -- 1.7.10.2