@Test public void testCustomColor() throws JSONException { final SubstitutionScheduleData scheduleData = new SubstitutionScheduleData(); final JSONObject data = new JSONObject(); final JSONObject colors = new JSONObject(); final JSONArray values = new JSONArray(); values.put("Vertretung"); colors.put("#123456", values); data.put("colors", colors); scheduleData.setData(data); final ColorProvider provider = new ColorProvider(scheduleData); assertEquals("#123456", provider.getColor("Vertretung")); }
public String getColor(String type) { if (type == null) { return null; } else if (colorMap.containsKey(type.toLowerCase())) { return colorMap.get(type.toLowerCase()); } else if (defaultColorMap.containsKey(type.toLowerCase())) { return defaultColorMap.get(type.toLowerCase()); } else { return defaultColor; } }
ColorProvider { public String getColor(String type) { if (type == null) { return null; } else if (colorMap.containsKey(type.toLowerCase())) { return colorMap.get(type.toLowerCase()); } else if (defaultColorMap.containsKey(type.toLowerCase())) { return defaultColorMap.get(type.toLowerCase()); } else { return defaultColor; } } }
ColorProvider { public String getColor(String type) { if (type == null) { return null; } else if (colorMap.containsKey(type.toLowerCase())) { return colorMap.get(type.toLowerCase()); } else if (defaultColorMap.containsKey(type.toLowerCase())) { return defaultColorMap.get(type.toLowerCase()); } else { return defaultColor; } } ColorProvider(SubstitutionScheduleData data);   ColorProvider(); }
ColorProvider { public String getColor(String type) { if (type == null) { return null; } else if (colorMap.containsKey(type.toLowerCase())) { return colorMap.get(type.toLowerCase()); } else if (defaultColorMap.containsKey(type.toLowerCase())) { return defaultColorMap.get(type.toLowerCase()); } else { return defaultColor; } } ColorProvider(SubstitutionScheduleData data);   ColorProvider(); String getColor(String type); }
ColorProvider { public String getColor(String type) { if (type == null) { return null; } else if (colorMap.containsKey(type.toLowerCase())) { return colorMap.get(type.toLowerCase()); } else if (defaultColorMap.containsKey(type.toLowerCase())) { return defaultColorMap.get(type.toLowerCase()); } else { return defaultColor; } } ColorProvider(SubstitutionScheduleData data);   ColorProvider(); String getColor(String type);  }