### Question:
Colors { public static Paint getColor(Attributed attributed) { Map<String, String> map = attributed.getAttributeMap(); if (map.containsKey("VertexType")) { String typeValue = map.get("VertexType"); return VERTEX_TYPE_TO_COLOR_MAP.getOrDefault(typeValue, Color.blue); } if (map.containsKey("EdgeType")) { String typeValue = map.get("EdgeType"); return EDGE_TYPE_TO_COLOR_MAP.getOrDefault(typeValue, Color.green); } if (map.containsKey("Color")) { String colorName = map.get("Color"); if (WEB_COLOR_MAP.containsKey(colorName)) { return WEB_COLOR_MAP.get(colorName); } Color c = getHexColor(colorName); if (c != null) { return c; } } return Color.green; } private  Colors(); static Paint getColor(Attributed attributed); static Color getHexColor(String hexString); static Map<String,Paint> VERTEX_TYPE_TO_COLOR_MAP; static Map<String,Paint> EDGE_TYPE_TO_COLOR_MAP; }### Answer:
@Test public void testGetColorFromVertexType() { AttributedVertex vertex = new AttributedVertex("A"); vertex.setAttribute("VertexType", "Exit"); vertex.setAttribute("Color", "0xffffff"); assertEquals(Color.MAGENTA, Colors.getColor(vertex)); }
@Test public void testGetColorFromVertexNoVertexType() { AttributedVertex vertex = new AttributedVertex("A"); vertex.setAttribute("Color", "0xffffff"); assertEquals(Color.WHITE, Colors.getColor(vertex)); }
@Test public void testGetColorFromVertexNoAttributes() { AttributedVertex vertex = new AttributedVertex("A"); assertEquals(Color.GREEN, Colors.getColor(vertex)); }
@Test public void testGetColorFromEdgeType() { AttributedEdge edge = new AttributedEdge("A"); edge.setAttribute("EdgeType", "Computed"); edge.setAttribute("Color", "0xffffff"); assertEquals(Color.CYAN, Colors.getColor(edge)); }
@Test public void testGetColorFromEdgeNoEdgeType() { AttributedEdge edge = new AttributedEdge("A"); edge.setAttribute("Color", "0xffffff"); assertEquals(Color.WHITE, Colors.getColor(edge)); }