GlobalPosition circlePosition = GlobalPosition.from(circlePoint);
cl.setCirclePoint(circlePosition);
cl.setRadius(centerPosition.distanceTo(circlePosition));
EnvironmentEventModel ee1 =
new EnvironmentEventModel(EnvironmentEventModel.Type.CO2, 12, cl);
///////////////////////////////////
// set up ee2 with PloygonLocation
PolygonLocationModel pl = new PolygonLocationModel();
List<GlobalPosition> positions = new ArrayList<GlobalPosition>();
Point2D p1 = new Point2D.Double(3,4);
GlobalPosition gp1 = GlobalPosition.from(p1);
positions.add(gp1);
Point2D p2 = new Point2D.Double(13,14);
GlobalPosition gp2 = GlobalPosition.from(p2);
positions.add(gp2);
Point2D p3 = new Point2D.Double(22,23);
GlobalPosition gp3 = GlobalPosition.from(p3);
positions.add(gp3);
Point2D p4 = new Point2D.Double(12,9);
GlobalPosition gp4 = GlobalPosition.from(p4);
positions.add(gp4);
Point2D p5 = new Point2D.Double(3,34);
GlobalPosition gp5 = GlobalPosition.from(p5);
positions.add(gp5);
pl.setPoints(positions);
EnvironmentEventModel ee2 =
new EnvironmentEventModel(EnvironmentEventModel.Type.Fog, -23, pl);
///////////////////////////////////
// set up ee3 with EdgeLocation
NodeModel fromNode = new NodeModel(2.3, 45,6);
NodeModel toNode = new NodeModel(45.22, 78.899);
EdgeModel e = new EdgeModel("testModelID", fromNode, toNode);
EdgeLocationModel el = new EdgeLocationModel(e, -12.3, -55.67);
EnvironmentEventModel ee3 =
new EnvironmentEventModel(EnvironmentEventModel.Type.Snow, 0, el);
///////////////////////////////////
// run assertions
Assert.assertEquals(12, ee1.getStrength());
Assert.assertEquals(-23, ee2.getStrength());
Assert.assertEquals(0, ee3.getStrength());
Assert.assertEquals(EnvironmentEventModel.Type.CO2, ee1.getEventType());
Assert.assertEquals(EnvironmentEventModel.Type.Fog, ee2.getEventType());
Assert.assertEquals(EnvironmentEventModel.Type.Snow, ee3.getEventType());
ee1.setEventType(EnvironmentEventModel.Type.Ice);
Assert.assertEquals(EnvironmentEventModel.Type.Ice, ee1.getEventType());
Assert.assertEquals(0.5, ee1.getEventEffect());
Assert.assertEquals(0.7, ee2.getEventEffect());
Assert.assertEquals(0.8, ee3.getEventEffect());
}