Java Code Examples for junit.framework.TestCase

The following are top voted examples for showing how to use junit.framework.TestCase. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: LightSIP   File: Shootist.java   Source Code and License 6 votes vote down vote up
public void processRequest(RequestEvent requestReceivedEvent) {
    Request request = requestReceivedEvent.getRequest();
    ServerTransaction serverTransactionId = requestReceivedEvent
            .getServerTransaction();

    logger.info("\n\nRequest " + request.getMethod() + " received at "
            +  sipStack.getStackName()
            + " with server transaction id " + serverTransactionId);

    // We are the UAC so the only request we get is the BYE.
    if (request.getMethod().equals(Request.BYE))
        processBye(request, serverTransactionId);
    else
        TestCase.fail("Unexpected request ! : " + request);

}
 
Example 2
Project: featurea   File: CapsuleCapsuleTest.java   Source Code and License 6 votes vote down vote up
/**
 * Tests {@link Shape} AABB.
 */
@Test
public void detectShapeAABB() {
    Transform t1 = new Transform();
    Transform t2 = new Transform();

    // test containment
    TestCase.assertTrue(this.sap.detect(capsule1, t1, capsule2, t2));
    TestCase.assertTrue(this.sap.detect(capsule2, t2, capsule1, t1));

    // test overlap
    t1.translate(-0.5, 0.0);
    TestCase.assertTrue(this.sap.detect(capsule1, t1, capsule2, t2));
    TestCase.assertTrue(this.sap.detect(capsule2, t2, capsule1, t1));

    // test only AABB overlap
    t2.translate(0.0, 0.7);
    TestCase.assertTrue(this.sap.detect(capsule1, t1, capsule2, t2));
    TestCase.assertTrue(this.sap.detect(capsule2, t2, capsule1, t1));

    // test no overlap
    t2.translate(1.0, 0.0);
    TestCase.assertFalse(this.sap.detect(capsule1, t1, capsule2, t2));
    TestCase.assertFalse(this.sap.detect(capsule2, t2, capsule1, t1));
}
 
Example 3
Project: featurea   File: EllipseEllipseTest.java   Source Code and License 6 votes vote down vote up
/**
 * Tests {@link Shape} AABB.
 */
@Test
public void detectShapeAABB() {
    Transform t1 = new Transform();
    Transform t2 = new Transform();

    // test containment
    TestCase.assertTrue(this.sap.detect(c1, t1, c2, t2));
    TestCase.assertTrue(this.sap.detect(c2, t2, c1, t1));

    // test overlap
    t1.translate(-0.5, 0.0);
    TestCase.assertTrue(this.sap.detect(c1, t1, c2, t2));
    TestCase.assertTrue(this.sap.detect(c2, t2, c1, t1));

    // test only AABB overlap
    t2.translate(0.0, -0.62);
    TestCase.assertTrue(this.sap.detect(c1, t1, c2, t2));
    TestCase.assertTrue(this.sap.detect(c2, t2, c1, t1));

    // test no overlap
    t1.translate(-1.0, 0.0);
    TestCase.assertFalse(this.sap.detect(c1, t1, c2, t2));
    TestCase.assertFalse(this.sap.detect(c2, t2, c1, t1));
}
 
Example 4
Project: featurea   File: WorldTest.java   Source Code and License 6 votes vote down vote up
/**
 * Tests the joint iterator.
 */
@Test
public void jointIterator() {
    World w = new World();

    w.addJoint(new AngleJoint(new Body(), new Body()));
    w.addJoint(new AngleJoint(new Body(), new Body()));
    w.addJoint(new AngleJoint(new Body(), new Body()));
    w.addJoint(new AngleJoint(new Body(), new Body()));

    Iterator<Joint> it = w.getJointIterator();
    while (it.hasNext()) {
        it.next();
    }

    it = w.getJointIterator();
    while (it.hasNext()) {
        it.next();
        it.remove();
    }

    TestCase.assertEquals(0, w.getJointCount());
}
 
Example 5
Project: LightSIP   File: Shootme.java   Source Code and License 6 votes vote down vote up
public SipProvider createProvider() {
    try {

        ListeningPoint lp = sipStack.createListeningPoint(myAddress,
                myPort, transport);

        sipProvider = sipStack.createSipProvider(lp);
        logger.info("provider " + sipProvider);
        logger.info("sipStack = " + sipStack);
        return sipProvider;
    } catch (Exception ex) {
        logger.error(ex);
        TestCase.fail(unexpectedException);
        return null;

    }

}
 
Example 6
Project: LightSIP   File: Notifier.java   Source Code and License 6 votes vote down vote up
public synchronized void processResponse(ResponseEvent responseReceivedEvent) {
    Response response = (Response) responseReceivedEvent.getResponse();
    Transaction tid = responseReceivedEvent.getClientTransaction();

    if(tid == null) {
        TestCase.assertTrue("retrans flag should be true", ((ResponseEventExt)responseReceivedEvent).isRetransmission());
    } else {
        TestCase.assertFalse("retrans flag should be false", ((ResponseEventExt)responseReceivedEvent).isRetransmission());
    }
    
    if ( response.getStatusCode() !=  200 ) {
        this.notifyCount --;
    } else {
        System.out.println("Notify Count = " + this.notifyCount);
    }

}
 
Example 7
Project: featurea   File: HullGeneratorTest.java   Source Code and License 6 votes vote down vote up
/**
 * Tests the Divide And Conquer class against the random
 * point cloud.
 */
@Test
public void divideAndConquer() {
    DivideAndConquer dac = new DivideAndConquer();
    Vector2[] hull = dac.generate(this.cloud);

    // make sure we can create a polygon from it
    // (this will check for convexity, winding, etc)
    Polygon poly = new Polygon(hull);

    // make sure all the points are either on or contained in the hull
    for (int i = 0; i < this.cloud.length; i++) {
        Vector2 p = this.cloud[i];
        if (!poly.contains(p, Transform.IDENTITY)) {
            TestCase.fail("Hull does not contain all points.");
        }
    }
}
 
Example 8
Project: featurea   File: FallbackNarrowphaseDetectorTest.java   Source Code and License 6 votes vote down vote up
/**
 * Test that fallback occurs for a type.
 */
@Test
public void singleTypedCondition() {
    FallbackNarrowphaseDetector detector = new FallbackNarrowphaseDetector(new Sat(), new Gjk());
    detector.addCondition(new SingleTypedFallbackCondition(Ellipse.class));
    // try all combos
    for (int i = 0; i < TYPES.length; i++) {
        for (int j = i; j < TYPES.length; j++) {
            boolean fallback = detector.isFallbackRequired(TYPES[i], TYPES[j]);
            if (TYPES[i] instanceof Ellipse || TYPES[j] instanceof Ellipse) {
                // any combo with an ellipse should fallback
                TestCase.assertTrue(fallback);
            } else {
                // all other combos shouldn't
                TestCase.assertFalse(fallback);
            }
        }
    }
}
 
Example 9
Project: featurea   File: Matrix33Test.java   Source Code and License 6 votes vote down vote up
/**
 * Tests the difference method.
 */
@Test
public void difference() {
    Matrix33 m1 = new Matrix33(0.0, 2.0, 0.0,
            3.0, 1.0, 1.0,
            2.0, 0.0, -1.0);
    Matrix33 m2 = new Matrix33(1.0, 1.0, 3.0,
            0.0, 4.0, 1.0,
            2.0, 2.0, 1.0);
    Matrix33 m3 = m1.difference(m2);
    // test the values
    TestCase.assertEquals(-1.0, m3.m00);
    TestCase.assertEquals(1.0, m3.m01);
    TestCase.assertEquals(-3.0, m3.m02);
    TestCase.assertEquals(3.0, m3.m10);
    TestCase.assertEquals(-3.0, m3.m11);
    TestCase.assertEquals(0.0, m3.m12);
    TestCase.assertEquals(0.0, m3.m20);
    TestCase.assertEquals(-2.0, m3.m21);
    TestCase.assertEquals(-2.0, m3.m22);
    // make sure we didnt modify the first matrix
    TestCase.assertFalse(m1.equals(m3));
}
 
Example 10
Project: featurea   File: ConservativeAdvancementTest.java   Source Code and License 6 votes vote down vote up
/**
 * Tests the time of impact computation in a failure case
 * where the two bodies are moving in the same direction
 * but the bodies do not collide.
 */
@Test
public void sameDirectionNoCollision2() {
    // S--------------------->E
    //               S----------->E

    Transform t1 = new Transform();
    t1.translate(0.0, 1.0);
    Vector2 dp1 = new Vector2(120.0 * TIME_STEP, 0.0);

    Convex c2 = Geometry.createSquare(0.5);
    Transform t2 = new Transform();
    t2.translate(1.6, 1.5);
    Vector2 dp2 = new Vector2(60.0 * TIME_STEP, 0.0);

    // detect the time of impact
    TimeOfImpact toi = new TimeOfImpact();
    boolean collision = this.detector.getTimeOfImpact(this.c1, t1, dp1, 0.0, c2, t2, dp2, 0.0, 0.0, 1.0, toi);
    TestCase.assertFalse(collision);
}
 
Example 11
Project: featurea   File: BroadphaseTest.java   Source Code and License 6 votes vote down vote up
/**
 * Tests the addChild method.
 */
@Test
public void add() {
    CollidableTest ct = new CollidableTest(Geometry.createCircle(1.0));

    // make sure its not there first
    TestCase.assertFalse(this.sap.contains(ct));
    TestCase.assertFalse(this.dyn.contains(ct));

    // addChild the item to the broadphases
    this.sap.add(ct);
    this.dyn.add(ct);

    // make sure they are there
    TestCase.assertTrue(this.sap.contains(ct));
    TestCase.assertTrue(this.dyn.contains(ct));
}
 
Example 12
Project: featurea   File: BodyTest.java   Source Code and License 6 votes vote down vote up
/**
 * Tests bodies in contact with multiple fixtures ensuring that the
 * getInContactBodies method only returns one instance of the in contact
 * body.
 */
@Test
public void getInContactBodiesMulti() {
    World w = new World();

    Body b1 = new Body();
    Body b2 = new Body();

    b1.addFixture(Geometry.createRectangle(15.0, 1.0));
    b1.setMass(MassType.NORMAL);

    b2.addFixture(Geometry.createSquare(1.0));
    Convex c = Geometry.createSquare(1.0);
    c.translate(-0.5, 0.0);
    b2.addFixture(c);
    b2.setMass(MassType.NORMAL);
    b2.translate(0.0, 0.75);

    w.addBody(b1);
    w.addBody(b2);

    w.step(1);

    List<Body> cbs = b1.getInContactBodies(false);
    TestCase.assertEquals(1, cbs.size());
}
 
Example 13
Project: featurea   File: BodyTest.java   Source Code and License 6 votes vote down vote up
/**
 * Tests the getJoinedBodies method.
 */
@Test
public void getJoinedBodies() {
    Body b1 = new Body();
    Body b2 = new Body();

    List<Body> bodies = b1.getJoinedBodies();
    TestCase.assertNotNull(bodies);
    TestCase.assertTrue(bodies.isEmpty());

    Joint j = new DistanceJoint(b1, b2, new Vector2(), new Vector2());
    JointEdge je1 = new JointEdge(b2, j);
    JointEdge je2 = new JointEdge(b1, j);

    b1.joints.add(je1);
    b2.joints.add(je2);

    bodies = b1.getJoinedBodies();
    TestCase.assertNotNull(bodies);
    TestCase.assertFalse(bodies.isEmpty());
    TestCase.assertSame(b2, bodies.get(0));
}
 
Example 14
Project: LightSIP   File: Shootme.java   Source Code and License 6 votes vote down vote up
public SipProvider createProvider() {
    try {

        ListeningPoint lp = sipStack.createListeningPoint(myAddress,
                myPort, transport);

        sipProvider = sipStack.createSipProvider(lp);
        logger.info("provider " + sipProvider);
        logger.info("sipStack = " + sipStack);
        return sipProvider;
    } catch (Exception ex) {
        logger.error(ex);
        TestCase.fail(unexpectedException);
        return null;

    }

}
 
Example 15
Project: featurea   File: TriangleEllipseTest.java   Source Code and License 6 votes vote down vote up
/**
 * Tests {@link Collidable} AABB.
 */
@Test
public void detectCollidableAABB() {
    // create some collidables
    CollidableTest ct1 = new CollidableTest(t);
    CollidableTest ct2 = new CollidableTest(e);

    // test containment
    TestCase.assertTrue(this.sap.detect(ct1, ct2));
    TestCase.assertTrue(this.sap.detect(ct2, ct1));

    // test overlap
    ct1.translate(-0.8, 0.0);
    TestCase.assertTrue(this.sap.detect(ct1, ct2));
    TestCase.assertTrue(this.sap.detect(ct2, ct1));

    // test only AABB overlap
    ct2.translate(0.5, -0.5);
    TestCase.assertTrue(this.sap.detect(ct1, ct2));
    TestCase.assertTrue(this.sap.detect(ct2, ct1));

    // test no overlap
    ct2.translate(1.0, 0.5);
    TestCase.assertFalse(this.sap.detect(ct1, ct2));
    TestCase.assertFalse(this.sap.detect(ct2, ct1));
}
 
Example 16
Project: featurea   File: RectangleHalfEllipseTest.java   Source Code and License 6 votes vote down vote up
/**
 * Tests {@link Collidable} AABB.
 */
@Test
public void detectCollidableAABB() {
    // create some collidables
    CollidableTest ct1 = new CollidableTest(r);
    CollidableTest ct2 = new CollidableTest(e);

    // test containment
    TestCase.assertTrue(this.sap.detect(ct1, ct2));
    TestCase.assertTrue(this.sap.detect(ct2, ct1));

    // test overlap
    ct1.translate(-1.0, 0.0);
    TestCase.assertTrue(this.sap.detect(ct1, ct2));
    TestCase.assertTrue(this.sap.detect(ct2, ct1));

    // test AABB overlap
    ct2.translate(0.0, -1.2);
    TestCase.assertTrue(this.sap.detect(ct1, ct2));
    TestCase.assertTrue(this.sap.detect(ct1, ct2));

    // test no overlap
    ct2.translate(1.0, 0.0);
    TestCase.assertFalse(this.sap.detect(ct1, ct2));
    TestCase.assertFalse(this.sap.detect(ct2, ct1));
}
 
Example 17
Project: featurea   File: AABBTest.java   Source Code and License 6 votes vote down vote up
/**
 * Tests the isDegenerate methods.
 */
@Test
public void degenerate() {
    AABB aabb = new AABB(0.0, 0.0, 0.0, 0.0);
    TestCase.assertTrue(aabb.isDegenerate());

    aabb = new AABB(1.0, 2.0, 1.0, 3.0);
    TestCase.assertTrue(aabb.isDegenerate());

    aabb = new AABB(1.0, 0.0, 2.0, 1.0);
    TestCase.assertFalse(aabb.isDegenerate());

    aabb = new AABB(1.0, 0.0, 1.000001, 2.0);
    TestCase.assertFalse(aabb.isDegenerate());
    TestCase.assertFalse(aabb.isDegenerate(Epsilon.E));
    TestCase.assertTrue(aabb.isDegenerate(0.000001));
}
 
Example 18
Project: featurea   File: WorldTest.java   Source Code and License 6 votes vote down vote up
/**
 * Tests the addChild body method.
 */
@Test
public void addJoint() {
    World w = new World();
    Body b1 = new Body();
    Body b2 = new Body();

    Joint j = new DistanceJoint(b1, b2, new Vector2(), new Vector2());

    w.addBody(b1);
    w.addBody(b2);
    w.addJoint(j);

    TestCase.assertTrue(w.getJointCount() > 0);
    TestCase.assertFalse(b1.joints.isEmpty());
    TestCase.assertFalse(b2.joints.isEmpty());
}
 
Example 19
Project: featurea   File: TriangleTriangleTest.java   Source Code and License 6 votes vote down vote up
/**
 * Tests {@link Shape} AABB.
 */
@Test
public void detectShapeAABB() {
    Transform t1 = new Transform();
    Transform t2 = new Transform();

    // test containment
    TestCase.assertTrue(this.sap.detect(tri1, t1, tri2, t2));
    TestCase.assertTrue(this.sap.detect(tri2, t2, tri1, t1));

    // test overlap
    t2.translate(0.0, 0.5);
    TestCase.assertTrue(this.sap.detect(tri1, t1, tri2, t2));
    TestCase.assertTrue(this.sap.detect(tri2, t2, tri1, t1));

    // test only AABB overlap
    t2.translate(0.0, 0.3);
    TestCase.assertTrue(this.sap.detect(tri1, t1, tri2, t2));
    TestCase.assertTrue(this.sap.detect(tri2, t2, tri1, t1));

    // test no overlap
    t2.translate(0.0, 0.3);
    TestCase.assertFalse(this.sap.detect(tri1, t1, tri2, t2));
    TestCase.assertFalse(this.sap.detect(tri2, t2, tri1, t1));
}
 
Example 20
Project: featurea   File: EllipseHalfEllipseTest.java   Source Code and License 6 votes vote down vote up
/**
 * Tests {@link Collidable} AABB.
 */
@Test
public void detectCollidableAABB() {
    // create some collidables
    CollidableTest ct1 = new CollidableTest(c1);
    CollidableTest ct2 = new CollidableTest(c2);

    // test containment
    TestCase.assertTrue(this.sap.detect(ct1, ct2));
    TestCase.assertTrue(this.sap.detect(ct2, ct1));

    // test overlap
    ct1.translate(-0.5, 0.0);
    TestCase.assertTrue(this.sap.detect(ct1, ct2));
    TestCase.assertTrue(this.sap.detect(ct2, ct1));

    // test only AABB overlap
    ct2.translate(0.0, -1.15);
    TestCase.assertTrue(this.sap.detect(ct1, ct2));
    TestCase.assertTrue(this.sap.detect(ct2, ct1));

    // test no overlap
    ct1.translate(-1.0, 0.0);
    TestCase.assertFalse(this.sap.detect(ct1, ct2));
    TestCase.assertFalse(this.sap.detect(ct2, ct1));
}
 
Example 21
Project: featurea   File: PolygonTest.java   Source Code and License 6 votes vote down vote up
/**
 * Tests the rotate methods.
 */
@Test
public void rotate() {
    Vector2[] vertices = new Vector2[]{
            new Vector2(0.0, 1.0),
            new Vector2(-1.0, -1.0),
            new Vector2(1.0, -1.0)
    };
    Polygon p = new Polygon(vertices);

    // should move the points
    p.rotate(Math.toRadians(90), 0, 0);

    TestCase.assertEquals(-1.000, p.vertices[0].x, 1.0e-3);
    TestCase.assertEquals(0.000, p.vertices[0].y, 1.0e-3);

    TestCase.assertEquals(1.000, p.vertices[1].x, 1.0e-3);
    TestCase.assertEquals(-1.000, p.vertices[1].y, 1.0e-3);

    TestCase.assertEquals(1.000, p.vertices[2].x, 1.0e-3);
    TestCase.assertEquals(1.000, p.vertices[2].y, 1.0e-3);
}
 
Example 22
Project: featurea   File: IslandTest.java   Source Code and License 6 votes vote down vote up
/**
 * Tests the clear method.
 */
@Test
public void clear() {
    Island i = new Island();

    i.add(new Body());
    i.add(new AngleJoint(new Body(), new Body()));
    i.add(new ContactConstraint(new Body(), new BodyFixture(Geometry.createCircle(1.0)), new Body(), new BodyFixture(Geometry.createCircle(1.0)), new Manifold(new ArrayList<ManifoldPoint>(), new Vector2()), 0, 0));

    TestCase.assertEquals(1, i.bodies.size());
    TestCase.assertEquals(1, i.joints.size());
    TestCase.assertEquals(1, i.contactConstraints.size());

    i.clear();

    TestCase.assertEquals(0, i.bodies.size());
    TestCase.assertEquals(0, i.joints.size());
    TestCase.assertEquals(0, i.contactConstraints.size());
}
 
Example 23
Project: incubator-netbeans   File: SimpleWeakSetTesting.java   Source Code and License 5 votes vote down vote up
public static void removeElement(Context context, int listIndex) throws Exception {
    SimpleWeakSet simpleWeakSet = context.getInstance(SimpleWeakSet.class);
    List removedList = (List) context.getProperty(REMOVED_LIST);
    List list = context.getInstance(List.class);
    Object element = list.remove(listIndex);
    removedList.add(element);
    Object removedElement = simpleWeakSet.remove(element);
    TestCase.assertEquals(element, removedElement);

    StringBuilder sb = context.logOpBuilder();
    if (sb != null) {
        sb.append("Remove[").append(listIndex).append("]: ").append(element).append("\n");
        context.logOp(sb);
    }
}
 
Example 24
Project: featurea   File: TypeFilterTest.java   Source Code and License 5 votes vote down vote up
/**
 * Tests the filter method of the TypeFilter class.
 */
@Test
public void filter() {
    // all should let all of them work
    TestCase.assertTrue(ALL.isAllowed(ALL));
    TestCase.assertTrue(ALL.isAllowed(CATEGORY_1));
    TestCase.assertTrue(ALL.isAllowed(CATEGORY_2));
    TestCase.assertTrue(ALL.isAllowed(CATEGORY_3));
    TestCase.assertTrue(ALL.isAllowed(CATEGORY_4));
    TestCase.assertTrue(CATEGORY_1.isAllowed(ALL));
    TestCase.assertTrue(CATEGORY_2.isAllowed(ALL));
    TestCase.assertTrue(CATEGORY_3.isAllowed(ALL));
    TestCase.assertTrue(CATEGORY_4.isAllowed(ALL));

    // since these are not in the same branch they should not be allowed
    TestCase.assertFalse(CATEGORY_1.isAllowed(CATEGORY_2));
    TestCase.assertFalse(CATEGORY_3.isAllowed(CATEGORY_2));
    TestCase.assertFalse(CATEGORY_4.isAllowed(CATEGORY_2));
    TestCase.assertFalse(CATEGORY_3.isAllowed(CATEGORY_4));
    // try the reverse
    TestCase.assertFalse(CATEGORY_2.isAllowed(CATEGORY_1));
    TestCase.assertFalse(CATEGORY_2.isAllowed(CATEGORY_3));
    TestCase.assertFalse(CATEGORY_2.isAllowed(CATEGORY_4));
    TestCase.assertFalse(CATEGORY_4.isAllowed(CATEGORY_3));

    TestCase.assertTrue(CATEGORY_1.isAllowed(CATEGORY_3));
    TestCase.assertTrue(CATEGORY_1.isAllowed(CATEGORY_4));
    TestCase.assertTrue(CATEGORY_3.isAllowed(CATEGORY_1));
    TestCase.assertTrue(CATEGORY_4.isAllowed(CATEGORY_1));

    // null and any other type should return false
    TestCase.assertFalse(ALL.isAllowed(null));
    TestCase.assertFalse(ALL.isAllowed(new CategoryFilter()));
}
 
Example 25
Project: featurea   File: PinJointTest.java   Source Code and License 5 votes vote down vote up
/**
 * Tests the pin joint with a body who has FIXED_LINEAR_VELOCITY as its
 * mass type.  The pin joint applied at a point on the body should rotate
 * the body (before it wasn't doing anything).
 */
@Test
public void fixedLinearVelocity() {
    World w = new World();

    Body body = new Body();
    body.addFixture(Geometry.createCircle(1.0));
    body.setMass(MassType.FIXED_LINEAR_VELOCITY);
    w.addBody(body);

    PinJoint mj = new PinJoint(body, new Vector2(0.5, 0.0), 8.0, 0.3, 1000.0);
    w.addJoint(mj);

    mj.setTarget(new Vector2(0.7, -0.5));

    w.step(1);

    TestCase.assertTrue(mj.getReactionForce(w.step.invdt).getMagnitude() > 0);
    TestCase.assertTrue(mj.getReactionForce(w.step.invdt).getMagnitude() <= 1000.0);
    TestCase.assertTrue(body.getTransform().getRotation() < 0);
}
 
Example 26
Project: featurea   File: BalancedBinarySearchTreeTest.java   Source Code and License 5 votes vote down vote up
/**
 * Tests the contains method.
 */
@Test
public void contains() {
    TestCase.assertTrue(tree.contains(9));
    TestCase.assertFalse(tree.contains(14));

    BinarySearchTreeNode<Integer> node = tree.get(-3);
    TestCase.assertTrue(tree.contains(node));

    node = new BinarySearchTreeNode<Integer>(-3);
    TestCase.assertFalse(tree.contains(node));
}
 
Example 27
Project: featurea   File: EarClippingTest.java   Source Code and License 5 votes vote down vote up
/**
 * Tests the triangulation implementation against the zoom1 data file.
 *
 * @since 3.1.9
 */
@Test
public void successZoom2() {
    Vector2[] vertices = this.load(EarClippingTest.class.getResourceAsStream("/featurea/physics/data/zoom2.dat"));

    // decompose the poly
    List<? extends Convex> result = this.algo.decompose(vertices);

    // the result should have n - 2 triangles shapes
    TestCase.assertTrue(result.size() <= vertices.length - 2);
}
 
Example 28
Project: featurea   File: PolygonTest.java   Source Code and License 5 votes vote down vote up
/**
 * Tests the createAABB method.
 *
 * @since 3.1.0
 */
@Test
public void createAABB() {
    Vector2[] vertices = new Vector2[]{
            new Vector2(0.0, 1.0),
            new Vector2(-1.0, -1.0),
            new Vector2(1.0, -1.0)
    };
    Polygon p = new Polygon(vertices);

    AABB aabb = p.createAABB(Transform.IDENTITY);
    TestCase.assertEquals(-1.0, aabb.getMinX(), 1.0e-3);
    TestCase.assertEquals(-1.0, aabb.getMinY(), 1.0e-3);
    TestCase.assertEquals(1.0, aabb.getMaxX(), 1.0e-3);
    TestCase.assertEquals(1.0, aabb.getMaxY(), 1.0e-3);

    // try using the default method
    AABB aabb2 = p.createAABB();
    TestCase.assertEquals(aabb.getMinX(), aabb2.getMinX());
    TestCase.assertEquals(aabb.getMinY(), aabb2.getMinY());
    TestCase.assertEquals(aabb.getMaxX(), aabb2.getMaxX());
    TestCase.assertEquals(aabb.getMaxY(), aabb2.getMaxY());

    Transform tx = new Transform();
    tx.rotate(Math.toRadians(30.0));
    tx.translate(1.0, 2.0);
    aabb = p.createAABB(tx);
    TestCase.assertEquals(0.500, aabb.getMinX(), 1.0e-3);
    TestCase.assertEquals(0.634, aabb.getMinY(), 1.0e-3);
    TestCase.assertEquals(2.366, aabb.getMaxX(), 1.0e-3);
    TestCase.assertEquals(2.866, aabb.getMaxY(), 1.0e-3);
}
 
Example 29
Project: dev-courses   File: TestMultiInsert.java   Source Code and License 5 votes vote down vote up
public static void main(String[] argv) {

        TestResult result = new TestResult();
        TestCase   testA  = new TestMultiInsert("testMultiInsert");

        testA.run(result);
        System.out.println("TestMultiInsert error count: " + result.failureCount());
        Enumeration e = result.failures();
        while(e.hasMoreElements()) System.out.println(e.nextElement());
    }
 
Example 30
Project: featurea   File: EarClippingTest.java   Source Code and License 5 votes vote down vote up
/**
 * Tests the implementation against the zoom7 data file.
 *
 * @since 3.1.9
 */
@Test
public void successZoom7() {
    Vector2[] vertices = this.load(EarClippingTest.class.getResourceAsStream("/featurea/physics/data/zoom7.dat"));

    // decompose the poly
    List<? extends Convex> result = this.algo.decompose(vertices);

    // the result should have n - 2 triangles shapes
    TestCase.assertTrue(result.size() <= vertices.length - 2);
}
 
Example 31
Project: featurea   File: SweepLineTest.java   Source Code and License 5 votes vote down vote up
/**
 * Tests the triangulation implementation against the zoom6 data file.
 *
 * @since 3.1.9
 */
@Test
public void triangulateSuccessZoom6() {
    Vector2[] vertices = this.load(SweepLineTest.class.getResourceAsStream("/featurea/physics/data/zoom6.dat"));

    // decompose the poly
    List<? extends Convex> result = this.algo.triangulate(vertices);

    // the result should have n - 2 triangles shapes
    TestCase.assertEquals(vertices.length - 2, result.size());
}
 
Example 32
Project: featurea   File: EpsilonTest.java   Source Code and License 5 votes vote down vote up
/**
 * Tests the machine epsilon computation.
 */
@Test
public void compute() {
    // ensure that the static variable is set
    TestCase.assertFalse(Epsilon.E == 0.0);
    // ensure the compute method returns in a
    // finite number of iterations
    Epsilon.compute();
    // ensure that the epsilon adds nothing to the
    // number 1
    TestCase.assertEquals(1.0, 1.0 + Epsilon.E);
}
 
Example 33
Project: featurea   File: BroadphaseTest.java   Source Code and License 5 votes vote down vote up
/**
 * Tests the shiftCoordinates method.
 */
@Test
public void shiftCoordinates() {
    CollidableTest ct1 = new CollidableTest(Geometry.createCircle(1.0));
    CollidableTest ct2 = new CollidableTest(Geometry.createUnitCirclePolygon(5, 0.5));
    CollidableTest ct3 = new CollidableTest(Geometry.createRectangle(1.0, 0.5));
    CollidableTest ct4 = new CollidableTest(Geometry.createVerticalSegment(2.0));

    ct1.translate(-2.0, 0.0);
    ct2.translate(-1.0, 1.0);
    ct3.translate(0.5, -2.0);
    ct4.translate(1.0, 1.0);

    // addChild the items to the broadphases
    this.sap.add(ct1);
    this.sap.add(ct2);
    this.sap.add(ct3);
    this.sap.add(ct4);
    this.dyn.add(ct1);
    this.dyn.add(ct2);
    this.dyn.add(ct3);
    this.dyn.add(ct4);

    // perform a detect on the whole broadphase
    List<BroadphasePair<CollidableTest, Fixture>> pairs = this.sap.detect();
    TestCase.assertEquals(1, pairs.size());
    pairs = this.dyn.detect();
    TestCase.assertEquals(1, pairs.size());

    // shift the broadphases
    Vector2 shift = new Vector2(1.0, -2.0);
    this.sap.shift(shift);
    this.dyn.shift(shift);

    // the number of pairs detected should be identical
    pairs = this.sap.detect();
    TestCase.assertEquals(1, pairs.size());
    pairs = this.dyn.detect();
    TestCase.assertEquals(1, pairs.size());
}
 
Example 34
Project: featurea   File: AngleJointTest.java   Source Code and License 5 votes vote down vote up
/**
 * Tests the successful setting of the minimum and maximum angle.
 */
@Test
public void setMinAndMax() {
    AngleJoint aj = new AngleJoint(new Body(), new Body());
    aj.setLimits(Math.toRadians(-30), Math.toRadians(20));

    TestCase.assertEquals(Math.toRadians(-30), aj.getLowerLimit(), 1e-6);
    TestCase.assertEquals(Math.toRadians(20), aj.getUpperLimit(), 1e-6);
}
 
Example 35
Project: LightSIP   File: Shootme.java   Source Code and License 5 votes vote down vote up
private void sendInviteOK(RequestEvent requestEvent, ServerTransaction inviteTid) {
    try {
        logger.info("sendInviteOK: " + inviteTid);
        if (inviteTid.getState() != TransactionState.COMPLETED) {
            logger.info("shootme: Dialog state before OK: "
                    + inviteTid.getDialog().getState());

            SipProvider sipProvider = (SipProvider) requestEvent.getSource();
            Request request = requestEvent.getRequest();
            Response okResponse = protocolObjects.messageFactory.createResponse(Response.OK,
                    request);
                ListeningPoint lp = sipProvider.getListeningPoint(protocolObjects.transport);
            int myPort = lp.getPort();

            Address address = protocolObjects.addressFactory.createAddress("Shootme <sip:"
                    + myAddress + ":" + myPort + ";transport=" + protocolObjects.transport +">");
            ContactHeader contactHeader = protocolObjects.headerFactory
                    .createContactHeader(address);
            okResponse.addHeader(contactHeader);
            inviteTid.sendResponse(okResponse);
            logger.info("shootme: Dialog state after OK: "
                    + inviteTid.getDialog().getState());
            TestHarness.assertEquals( DialogState.CONFIRMED , inviteTid.getDialog().getState() );
        } else {
            logger.info("semdInviteOK: inviteTid = " + inviteTid + " state = " + inviteTid.getState());
        }
    } catch (Exception ex) {
        logger.error("unexpected exception",ex);
        ex.printStackTrace();
        TestCase.fail("Unexpected exception occured");
    }
}
 
Example 36
Project: featurea   File: SweepLineTest.java   Source Code and License 5 votes vote down vote up
/**
 * Tests the implementation against the nazca_heron data file.
 */
@Test
public void successNazcaHeron() {
    Vector2[] vertices = this.load(SweepLineTest.class.getResourceAsStream("/featurea/physics/data/nazca_heron.dat"));

    // decompose the poly
    List<Convex> result = this.algo.decompose(vertices);

    // the result should have less than or equal to n - 2 convex shapes
    TestCase.assertTrue(result.size() <= vertices.length - 2);
}
 
Example 37
Project: incubator-netbeans   File: Typing.java   Source Code and License 5 votes vote down vote up
public void assertDocumentTextEquals(final String textWithPipe) {
    int caretOffset = textWithPipe.indexOf('|');
    String text;
    if (caretOffset != -1) {
        text = textWithPipe.substring(0, caretOffset) + textWithPipe.substring(caretOffset + 1);
    } else {
        text = textWithPipe;
    }
    try {
        // Use debug text to prefix special chars for easier readability
        text = CharSequenceUtilities.debugText(text);
        String docText = document().getText(0, document().getLength());
        docText = CharSequenceUtilities.debugText(docText);
        if (!text.equals(docText)) {
            int diffIndex = 0;
            int minLen = Math.min(docText.length(), text.length());
            while (diffIndex < minLen) {
                if (text.charAt(diffIndex) != docText.charAt(diffIndex)) {
                    break;
                }
                diffIndex++;
            }
            TestCase.fail("Invalid document text - diff at index " + diffIndex + "\nExpected: \"" + text + "\"\n  Actual: \"" + docText + "\"");
        }
    } catch (BadLocationException e) {
        throw new IllegalStateException(e);
    }
    if (caretOffset != -1) {
        TestCase.assertEquals("Invalid caret offset", caretOffset, pane.getCaretPosition());
    }
}
 
Example 38
Project: geopackage-android-map   File: GoogleMapShapeConverterUtils.java   Source Code and License 5 votes vote down vote up
/**
 * Compare two lists of points
 * 
 * @param points
 * @param points2
 */
private static void comparePoints(List<Point> points, List<Point> points2) {
	TestCase.assertEquals(points.size(), points2.size());

	for (int i = 0; i < points.size(); i++) {
		comparePoints(points.get(i), points2.get(i));
	}
}
 
Example 39
Project: incubator-netbeans   File: GuardUtils.java   Source Code and License 5 votes vote down vote up
public static void verifyGuardAttr(TestCase test, StyledDocument doc, InteriorSection gs) {
    PositionBounds bounds = gs.getImpl().getHeaderBounds();
    verifyGuardAttr(test, (GuardedDocument) doc, bounds.getBegin().getOffset(), bounds.getEnd().getOffset());
    bounds = gs.getImpl().getFooterBounds();
    verifyGuardAttr(test, (GuardedDocument) doc, bounds.getBegin().getOffset(), bounds.getEnd().getOffset());
    
}
 
Example 40
Project: featurea   File: MassTest.java   Source Code and License 5 votes vote down vote up
/**
 * Test case for the polygon create method.
 */
@Test
public void createPolygon() {
    Polygon p = Geometry.createUnitCirclePolygon(5, 0.5);
    Mass m = p.createMass(1.0);
    // the polygon mass should be the area * d
    TestCase.assertEquals(0.594, m.getMass(), 1.0e-3);
    TestCase.assertEquals(0.057, m.getInertia(), 1.0e-3);
}
 
Example 41
Project: LightSIP   File: RejectOutOfSequenceMessageTest.java   Source Code and License 5 votes vote down vote up
public void processResponse(ResponseEvent responseReceivedEvent) {
    try {
        Response response = responseReceivedEvent.getResponse();

        CSeqHeader cseq = (CSeqHeader) response
                .getHeader(CSeqHeader.NAME);

        System.out.println("Response " + response.getStatusCode()
                + " CSeq  = " + cseq.getSeqNumber());

        if (response.getStatusCode() == Response.OK
                && cseq.getMethod().equals(Request.INVITE)) {
            assertEquals("Should only see OK for seq number of 8", cseq
                    .getSeqNumber(), 8L);
            Request ackRequest = dialog.createAck(cseq.getSeqNumber());
            dialog.sendAck(ackRequest);
            Request badRequest = dialog.createRequest(Request.INVITE);
            CSeqHeader cseq1 = (CSeqHeader) badRequest
                    .getHeader(CSeqHeader.NAME);
            cseq1.setSeqNumber(1L);

            ClientTransaction badCt = sipProvider
                    .getNewClientTransaction(badRequest);

            badCt.sendRequest();
        } else if ( response.getStatusCode() == Response.SERVER_INTERNAL_ERROR) {
            this.saw500 = true;
        }
    } catch (Exception ex) {
        ex.printStackTrace();
        TestCase.fail("Unexpected exception");
    }

}
 
Example 42
Project: featurea   File: SweepLineTest.java   Source Code and License 5 votes vote down vote up
/**
 * Tests the triangulation implementation against the 4th polygon data file.
 *
 * @since 3.1.9
 */
@Test
public void triangulateSuccess5() {
    Vector2[] vertices = this.load(SweepLineTest.class.getResourceAsStream("/featurea/physics/data/polygon4.dat"));

    // decompose the poly
    List<Triangle> result = this.algo.triangulate(vertices);

    // the result should have n - 2 triangles shapes
    TestCase.assertEquals(vertices.length - 2, result.size());
}
 
Example 43
Project: featurea   File: Vector2Test.java   Source Code and License 5 votes vote down vote up
/**
 * Tests the triple product method.
 */
@Test
public void tripleProduct() {
    Vector2 v1 = new Vector2(1.0, 1.0);
    Vector2 v2 = new Vector2(1.0, -1.0);

    Vector2 r = Vector2.tripleProduct(v1, v2, v2);

    // the below would be -1.0 if the vectors were normalized
    TestCase.assertEquals(-2.000, r.x, 1.0e-3);
    TestCase.assertEquals(-2.000, r.y, 1.0e-3);
}
 
Example 44
Project: featurea   File: CircleTest.java   Source Code and License 5 votes vote down vote up
/**
 * Tests the getFoci method.
 */
@Test
public void getFoci() {
    Circle c = new Circle(1.5);
    Transform t = new Transform();
    // should only return one
    Vector2[] foci = c.getFoci(t);
    TestCase.assertEquals(1, foci.length);
}
 
Example 45
Project: LightSIP   File: Shootist.java   Source Code and License 5 votes vote down vote up
public synchronized void processResponse(ResponseEvent responseReceivedEvent) {
    logger.info("Got a response");
    Response response = responseReceivedEvent.getResponse();
    ClientTransaction tid = responseReceivedEvent.getClientTransaction();
    CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);

    logger.info("Response received : Status Code = " + response.getStatusCode() + " " + cseq);
    logger.info("Response = " + response + " class=" + response.getClass());

    Dialog dialog = responseReceivedEvent.getDialog();
    TestCase.assertNotNull(dialog);

    if (tid != null)
        logger.info("transaction state is " + tid.getState());
    else
        logger.info("transaction = " + tid);

    logger.info("Dialog = " + dialog);

    logger.info("Dialog state is " + dialog.getState());

    try {
        if (response.getStatusCode() == Response.OK) {
            if (cseq.getMethod().equals(Request.INVITE)) {
                TestCase.assertEquals(DialogState.CONFIRMED, dialog.getState());

            } else {
                logger.info("Response method = " + cseq.getMethod());
            }
        }
    } catch (Throwable ex) {
        ex.printStackTrace();
        // System.exit(0);
    }

}
 
Example 46
Project: parabuild-ci   File: TestSqlPersistent.java   Source Code and License 5 votes vote down vote up
public static void main(String argv[]) {

        TestResult result = new TestResult();
        TestCase   testC  = new TestSqlPersistent("testInsertObject");
        TestCase   testD  = new TestSqlPersistent("testSelectObject");

        testC.run(result);
        testD.run(result);
        System.out.println("TestSqlPersistent error count: "
                           + result.failureCount());
    }
 
Example 47
Project: featurea   File: EarClippingTest.java   Source Code and License 5 votes vote down vote up
/**
 * Tests the implementation against the 3rd polygon data file.
 */
@Test
public void success4() {
    Vector2[] vertices = this.load(EarClippingTest.class.getResourceAsStream("/featurea/physics/data/polygon3.dat"));

    // decompose the poly
    List<Convex> result = this.algo.decompose(vertices);

    // the result should have less than or equal to n - 2 convex shapes
    TestCase.assertTrue(result.size() <= vertices.length - 2);
}
 
Example 48
Project: parabuild-ci   File: TestSql.java   Source Code and License 5 votes vote down vote up
public static void main(String[] argv) {

        TestResult result = new TestResult();
        TestCase   testA  = new TestSql("testMetaData");
        TestCase   testB  = new TestSql("testDoubleNaN");
        TestCase   testC  = new TestSql("testAny");

        testA.run(result);
        testB.run(result);
        testC.run(result);
        System.out.println("TestSql error count: " + result.failureCount());
    }
 
Example 49
Project: featurea   File: WorldTest.java   Source Code and License 5 votes vote down vote up
/**
 * Tests the addChild listener method.
 */
@Test
public void addListener() {
    World w = new World();
    BoundsListener bl = new BoundsAdapter();
    w.addListener(bl);

    TestCase.assertSame(bl, w.getListeners(BoundsListener.class).get(0));
}
 
Example 50
Project: featurea   File: Matrix22Test.java   Source Code and License 5 votes vote down vote up
/**
 * Tests the invert method.
 */
@Test
public void invert() {
    Matrix22 m1 = new Matrix22(1.0, 2.0,
            3.0, 4.0);
    m1.invert();
    TestCase.assertEquals(-2.0, m1.m00);
    TestCase.assertEquals(1.0, m1.m01);
    TestCase.assertEquals(1.5, m1.m10);
    TestCase.assertEquals(-0.5, m1.m11);
}
 
Example 51
Project: jenkins-aws-bucket-credentials   File: AwsBucketCredentialsImplTest.java   Source Code and License 5 votes vote down vote up
@Test
public void closesIfIOExceptionWhileReading() throws Exception {
    AmazonS3Client mockClient = mock(AmazonS3Client.class);
    when(mockClientBuilder.build()).thenReturn(mockClient);

    AWSKMSClient mockKmsClient = mock(AWSKMSClient.class);
    when(mockKmsClientBuilder.build()).thenReturn(mockKmsClient);

    S3Object mockS3Object = mock(S3Object.class);
    when(mockClient.getObject(any(GetObjectRequest.class))).thenReturn(mockS3Object);
    S3ObjectInputStream mockS3ObjectInputStream = mock(S3ObjectInputStream.class);
    when(mockS3Object.getObjectContent()).thenReturn(mockS3ObjectInputStream);
    when(mockS3ObjectInputStream.read(new byte[anyInt()], anyInt(), anyByte()))
            .thenAnswer(new WriteBufferAnswer("encryptedPassword".getBytes()))
            .thenThrow(new IOException("something went wrong"))
            .thenReturn(-1);

    DecryptResult result = new DecryptResult();
    CharsetEncoder charsetEncoder = Charset.forName("UTF-8").newEncoder();
    result.setPlaintext(charsetEncoder.encode(CharBuffer.wrap("password")));
    when(mockKmsClient.decrypt(any(DecryptRequest.class))).thenReturn(result);

    Secret secret = null;
    try {
        secret = test.getPassword();
        TestCase.fail("should have thrown exception");
    } catch (AwsBucketReadingException e) {
        assertThat(e.getCause()).isInstanceOf(IOException.class);
    }

    // have we used the bucket
    ArgumentCaptor<GetObjectRequest> capturedObjectRequest = ArgumentCaptor.forClass(GetObjectRequest.class);
    verify(mockClient).getObject(capturedObjectRequest.capture());
    assertThat(capturedObjectRequest.getValue().getBucketName()).isEqualTo("bucketUri");
    assertThat(capturedObjectRequest.getValue().getS3ObjectId().getKey()).isEqualTo("/bucketPath");

    // and we have closed it even if there was an exception
    verify(mockS3Object).close();
}
 
Example 52
Project: featurea   File: UnitConversionTest.java   Source Code and License 5 votes vote down vote up
/**
 * Tests the foot to meter and meter to foot conversions.
 */
@Test
public void footMeter() {
    // test the static values
    TestCase.assertEquals(1.000, UnitConversion.FOOT_TO_METER * UnitConversion.METER_TO_FOOT);

    // test a normal value
    double m = 2.5;
    double f = UnitConversion.metersToFeet(m);
    double r = UnitConversion.feetToMeters(f);

    TestCase.assertEquals(m, r, 1.0e-9);
}
 
Example 53
Project: LightSIP   File: Shootist.java   Source Code and License 5 votes vote down vote up
@Override
public void run() {
   try {
       TestCase.assertEquals ("Dialog state must be confirmed",
                DialogState.CONFIRMED,dialog.getState());

       Request byeRequest = dialog.createRequest(Request.BYE);
       ClientTransaction ctx = sipProvider.getNewClientTransaction(byeRequest);
       dialog.sendRequest(ctx);
   } catch (Exception ex) {
       TestCase.fail("Unexpected exception");
   }

}
 
Example 54
Project: OpenDiabetes   File: TestMultiInsert.java   Source Code and License 5 votes vote down vote up
public static void main(String[] argv) {

        TestResult result = new TestResult();
        TestCase   testA  = new TestMultiInsert("testMultiInsert");

        testA.run(result);
        System.out.println("TestMultiInsert error count: " + result.failureCount());
        Enumeration e = result.failures();
        while(e.hasMoreElements()) System.out.println(e.nextElement());
    }
 
Example 55
Project: featurea   File: SegmentSegmentTest.java   Source Code and License 5 votes vote down vote up
/**
 * Tests {@link Gjk}.
 */
@Test
public void detectGjk() {
    Penetration p = new Penetration();
    Transform t1 = new Transform();
    Transform t2 = new Transform();

    // test overlap
    TestCase.assertTrue(this.gjk.detect(seg1, t1, seg2, t2, p));
    TestCase.assertTrue(this.gjk.detect(seg1, t1, seg2, t2));
    // try reversing the shapes
    TestCase.assertTrue(this.gjk.detect(seg2, t2, seg1, t1, p));
    TestCase.assertTrue(this.gjk.detect(seg2, t2, seg1, t1));

    // test AABB overlap
    t2.translate(0.5, 0.0);
    TestCase.assertFalse(this.gjk.detect(seg1, t1, seg2, t2, p));
    TestCase.assertFalse(this.gjk.detect(seg1, t1, seg2, t2));
    // try reversing the shapes
    TestCase.assertFalse(this.gjk.detect(seg2, t2, seg1, t1, p));
    TestCase.assertFalse(this.gjk.detect(seg2, t2, seg1, t1));

    // test no overlap
    t1.translate(-1.0, 0.0);
    TestCase.assertFalse(this.gjk.detect(seg1, t1, seg2, t2, p));
    TestCase.assertFalse(this.gjk.detect(seg1, t1, seg2, t2));
    // try reversing the shapes
    TestCase.assertFalse(this.gjk.detect(seg2, t2, seg1, t1, p));
    TestCase.assertFalse(this.gjk.detect(seg2, t2, seg1, t1));
}
 
Example 56
Project: featurea   File: BayazitTest.java   Source Code and License 5 votes vote down vote up
/**
 * Tests the implementation against the zoom7 data file.
 *
 * @since 3.1.9
 */
@Test
public void successZoom7() {
    Vector2[] vertices = this.load(BayazitTest.class.getResourceAsStream("/featurea/physics/data/zoom7.dat"));

    // decompose the poly
    List<? extends Convex> result = this.algo.decompose(vertices);

    // the result should have n - 2 triangles shapes
    TestCase.assertTrue(result.size() <= vertices.length - 2);
}
 
Example 57
Project: featurea   File: Vector2Test.java   Source Code and License 5 votes vote down vote up
/**
 * Tests the getAngleBetween method for the range.
 *
 * @since 3.1.5
 */
@Test
public void getAngleBetweenRange() {
    Vector2 v1 = new Vector2(-1.0, 2.0);
    Vector2 v2 = new Vector2(-2.0, -1.0);

    // this should return in the range of -pi,pi
    TestCase.assertTrue(Math.PI >= Math.abs(v1.getAngleBetween(v2)));
}
 
Example 58
Project: dev-courses   File: TestSql.java   Source Code and License 5 votes vote down vote up
public static void main(String[] argv) {

        TestResult result = new TestResult();
        TestCase   testA  = new TestSql("testMetaData");
        TestCase   testB  = new TestSql("testDoubleNaN");
        TestCase   testC  = new TestSql("testAny");

        testA.run(result);
        testB.run(result);
        testC.run(result);
        System.out.println("TestSql error count: " + result.failureCount());
    }
 
Example 59
Project: featurea   File: VersionTest.java   Source Code and License 5 votes vote down vote up
/**
 * Tests the getProperty verion number methods.
 */
@Test
public void versions() {
    // getProperty the version array
    int[] version = Version.getVersionNumbers();
    TestCase.assertEquals(Version.getMajorNumber(), version[0]);
    TestCase.assertEquals(Version.getMinorNumber(), version[1]);
    TestCase.assertEquals(Version.getRevisionNumber(), version[2]);
}
 
Example 60
Project: featurea   File: SweepLineTest.java   Source Code and License 5 votes vote down vote up
/**
 * Tests the triangulation implementation against the tridol2 data file.
 *
 * @since 3.1.10
 */
@Test
public void triangulateSuccessTridol2() {
    Vector2[] vertices = this.load(SweepLineTest.class.getResourceAsStream("/featurea/physics/data/tridol2.dat"));

    // decompose the poly
    List<? extends Convex> result = this.algo.triangulate(vertices);

    // the result should have n - 2 triangles shapes
    TestCase.assertEquals(vertices.length - 2, result.size());
}