public RelationshipStyle color(String color) { setColor(color); return this; }
public RelationshipStyle(String tag, Integer thickness, String color, Boolean dashed, Routing routing, Integer fontSize, Integer width, Integer position) { this.tag = tag; this.thickness = thickness; setColor(color); this.dashed = dashed; this.routing = routing; this.fontSize = fontSize; this.width = width; this.position = position; }
public RelationshipStyle findRelationshipStyle(Relationship relationship) { RelationshipStyle style = new RelationshipStyle("").color("#707070"); if (relationship != null) { for (String tag : relationship.getTagsAsSet()) { RelationshipStyle relationshipStyle = findRelationshipStyle(tag); if (relationshipStyle != null) { if (relationshipStyle.getColor() != null && relationshipStyle.getColor().trim().length() > 0) { style.setColor(relationshipStyle.getColor()); } } } } return style; }
@Test(expected = IllegalArgumentException.class) public void test_setColor_ThrowsAnException_WhenAnInvalidHexColorCodeIsSpecified() { RelationshipStyle style = new RelationshipStyle(); style.setColor("white"); }
@Test public void test_setColor_SetsTheColorProperty_WhenAValidHexColorCodeIsSpecified() { RelationshipStyle style = new RelationshipStyle(); style.setColor("#ffffff"); assertEquals("#ffffff", style.getColor()); style.setColor("#FFFFFF"); assertEquals("#ffffff", style.getColor()); style.setColor("#123456"); assertEquals("#123456", style.getColor()); }