In this class I'm trying to tests whether i get a correct result from the interiorPoints class. The interiorPoints class is a method that returns a lists of coordinates that lie within a polygon.
Below I'm checking whether the expected result is the same as the actual result which in this case they should be but the test seems to fail for a reason i can't figure out. Can someone help please.
public class TestInteriorPoints {
private InteriorPoints interiorPoints;
List<Point> TestPoints;
List<Point> convexHull;
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
interiorPoints = new InteriorPoints();
TestPoints = new ArrayList<Point>();
TestPoints.add(new Point(300,200));
TestPoints.add(new Point(600,500));
TestPoints.add(new Point(100,100));
TestPoints.add(new Point(200,200));
TestPoints.add(new Point(100,500));
TestPoints.add(new Point(600,100));
convexHull = new ArrayList<Point>();
convexHull.add(new Point(100,100));
convexHull.add(new Point(100,500));
convexHull.add(new Point(600,500));
convexHull.add(new Point(600,100));
}
@Test
public void testInteriorPoints() {
List<Point> expectedResult = new ArrayList<Point>();
expectedResult.add(new Point(300,200));
expectedResult.add(new Point(200,200));
List<Point> actualResult = new ArrayList<Point>();
actualResult = interiorPoints.interiorPoints(convexHull, TestPoints);
assertEquals("TEST5: Check for interior points", expectedResult, actualResult);
//assertTrue(expectedResult.containsAll(actualResult) && actualResult.containsAll(expectedResult));
}
}
Aucun commentaire:
Enregistrer un commentaire