package purrpackagedemo.polygon;
import org.testng.Assert;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;
import purrpackagedemo.Point;
/**
* Just to show to you that we can support TestNG; it is crazy to mix JUnit and
* TestNG, but this is a Demo. We all go a little mad, sometimes. Haven't you?
*/
public class PolygonTestNGTest extends Assert{
static Polygon tri, square;
@BeforeSuite
public static void setup() {
tri = new Polygon( new Point( -1, -1 ), new Point( 0, 1 ), new Point( 1, -1 ) );
square = new Polygon( new Point( -1, -1 ), new Point( -1, 1 ), new Point( 1, 1 ), new Point( 1, -1 ) );
}
@Test
public void testSpecialCases() {
// it doesn't even check, for better or worse.
assertFalse( new Polygon( Point.ORIGIN ).contains( null ));
assertFalse( tri.contains( new Point( -100, -100 )));
assertTrue( tri.isBetween( 2, 1, 3 ));
assertTrue( tri.isBetween( 2, 3, 1 ));
assertFalse( tri.isBetween( 4, 1, 3 ));
assertFalse( tri.isBetween( 4, 3, 1 ));
}
}