CategorizedColor extends CategorizedLegend<Color> { @Override public Color getFromLower(Double d){ if(d==null){ throw new NullPointerException("The input threshold must not be null"); } if(parameter instanceof ColorLiteral){ return ((ColorLiteral) parameter).getColor(null); } else { Color col = get(d); if(col == null){ Categorize2Color c2s = (Categorize2Color) parameter; Map<String,Object> inp = new HashMap<>(); inp.put(getField(), d); try { return c2s.getColor(inp); } catch (ParameterException e) { throw new IllegalStateException("May this categorize need many fields ?"); } } else { return col; } } } CategorizedColor(ColorParameter sp); @Override SeParameter getParameter(); void setParameter(ColorParameter param); Color getFallbackValue(); void setFallbackValue(Color value); @Override Color get(Double d); @Override void put(Double d, Color v); @Override Color remove(Double d); @Override Color getFromLower(Double d);  }
@Test public void testGetFromLower() throws Exception { CategorizedColor cs = new CategorizedColor(getCategorize2Color()); assertTrue(cs.getFromLower(25.0).equals(Color.decode("#332133"))); }