PointParameters extends AreaParameters { @Override public boolean equals(Object o){ if(o instanceof PointParameters){ PointParameters other = (PointParameters) o; boolean sup = super.equals(other); return sup && this.wkn.equals(other.wkn) && this.height.equals(other.height) && this.width.equals(other.width); } else { return false; } } PointParameters();  PointParameters(Color lineCol,
                          Double lineOp,
                          Double lineWidth,
                          String lineDash,
                          Color fillCol,
                          Double fillOp,
                          Double symWidth,
                          Double symHeight,
                          String symWkn); Double getWidth(); Double getHeight(); String getWkn(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testEquality() throws Exception { PointParameters pp = new PointParameters(Color.BLUE, .25, 42.0, "2", Color.YELLOW, .46, 1.0, 4.0, "SQUARE"); PointParameters pp2 = new PointParameters(Color.BLUE, .25, 42.0, "2", Color.YELLOW, .46, 1.0, 4.0, "SQUARE"); assertTrue(pp.equals(pp2)); pp = new PointParameters(Color.CYAN, .25, 42.0, "2", Color.YELLOW, .46, 1.0, 4.0, "SQUARE"); pp2 = new PointParameters(Color.BLUE, .25, 42.0, "2", Color.YELLOW, .46, 1.0, 4.0, "SQUARE"); assertFalse(pp.equals(pp2)); pp = new PointParameters(Color.BLUE, .25, 42.0, "2", Color.YELLOW, .8, 1.0, 4.0, "SQUARE"); pp2 = new PointParameters(Color.BLUE, .25, 42.0, "2", Color.YELLOW, .46, 1.0, 4.0, "SQUARE"); assertFalse(pp.equals(pp2)); pp = new PointParameters(Color.BLUE, .25, 42.0, "2", Color.YELLOW, .46, null, 4.0, "SQUARE"); pp2 = new PointParameters(Color.BLUE, .25, 42.0, "2", Color.YELLOW, .46, 3.0, 4.0, "SQUARE"); assertFalse(pp.equals(pp2)); pp = new PointParameters(Color.BLUE, .25, 42.0, "2", Color.YELLOW, .46, null, 5.0, "SQUARE"); pp2 = new PointParameters(Color.BLUE, .25, 42.0, "2", Color.YELLOW, .46, 5.0, 5.0, "SQUARE"); assertTrue(pp.equals(pp2)); pp = new PointParameters(Color.BLUE, .25, 42.0, "2", Color.YELLOW, .46, 1.0, null, "SQUARE"); pp2 = new PointParameters(Color.BLUE, .25, 42.0, "2", Color.YELLOW, .46, 1.0, 3.0, "SQUARE"); assertFalse(pp.equals(pp2)); pp = new PointParameters(Color.BLUE, .25, 42.0, "2", Color.YELLOW, .46, 1.0, null, "SQUARE"); pp2 = new PointParameters(Color.BLUE, .25, 42.0, "2", Color.YELLOW, .46, 1.0, 1.0, "SQUARE"); assertTrue(pp.equals(pp2)); pp = new PointParameters(Color.BLUE, .25, 42.0, "2", Color.YELLOW, .46, null, null, "SQUARE"); pp2 = new PointParameters(Color.BLUE, .25, 42.0, "2", Color.YELLOW, .46, 3.0, 3.0, "SQUARE"); assertTrue(pp.equals(pp2)); pp = new PointParameters(Color.BLUE, .25, 42.0, "2", Color.YELLOW, .46, 1.0, 4.0, null); pp2 = new PointParameters(Color.BLUE, .25, 42.0, "2", Color.YELLOW, .46, 1.0, 4.0, "CIRCLE"); assertTrue(pp.equals(pp2)); }
@Test public void testUniqueSymbolPointInstanciation() throws Exception { PointParameters ap = new PointParameters(Color.BLUE, .25, 42.0, "2", Color.CYAN, .46, 1.0, 4.0, "SQUARE"); UniqueSymbolPoint usp = new UniqueSymbolPoint(ap); assertTrue(usp.getFillLegend().getColor().equals(Color.CYAN)); assertTrue(usp.getFillLegend().getOpacity() - .46 < EPS); assertTrue(usp.getPenStroke().getDashArray().equals("2")); assertTrue(usp.getPenStroke().getLineWidth() - 42.0 < EPS); assertTrue(usp.getPenStroke().getLineColor().equals(Color.BLUE)); assertTrue(usp.getPenStroke().getLineOpacity() - .25 < EPS); assertTrue(usp.getWellKnownName().equalsIgnoreCase("SQUARE")); assertTrue(usp.getViewBoxWidth() - 1.0 < EPS); assertTrue(usp.getViewBoxHeight() - 4.0 < EPS); }
@Test public void testFromUniqueSymbolArea() throws Exception { PointParameters ap = new PointParameters(Color.BLUE, .25, 42.0, "2", Color.CYAN, .46, 1.0, 4.0, "SQUARE"); PointParameters ap2 = new PointParameters(Color.BLUE, .25, 42.0, "2", Color.CYAN, .46, 1.0, 4.0, "SQUARE"); UniqueSymbolPoint usa = new UniqueSymbolPoint(ap); assertTrue(ap2.equals(usa.getPointParameters())); }