### Question:
ColorUtil { public synchronized static String RgbToAnsi(String rgb, ColorSetting colorSetting, String terminalColor) { initColors(terminalColor); switch(colorSetting) { case OFF: return ""; case ON: return getClosestTerminalCode(colors.get(rgb), ansiColorsToTerminalCodes, colors.get(terminalColor)); case EXTENDED: return getClosestTerminalCode(colors.get(rgb), eightBitColorsToTerminalCodes, colors.get(terminalColor)); default: throw new UnsupportedOperationException("colorSettung: " + colorSetting); } } private  ColorUtil(); static Map<String, Color> colors(); synchronized static String RgbToAnsi(String rgb, ColorSetting colorSetting, String terminalColor); static Color getColorByName(String colorName); static final String ANSI_NORMAL; }### Answer:
@Test public void testGetColor() { System.setProperty("java.awt.headless", "true"); assertEquals("", ColorUtil.RgbToAnsi("red", ColorSetting.OFF, "black")); assertEquals("\u001b[31m", ColorUtil.RgbToAnsi("red", ColorSetting.ON, "black")); assertEquals("", ColorUtil.RgbToAnsi("red", ColorSetting.OFF, "red")); }