当前位置: 首页>>代码示例>>Java>>正文


Java TestCase.assertNull方法代码示例

本文整理汇总了Java中junit.framework.TestCase.assertNull方法的典型用法代码示例。如果您正苦于以下问题:Java TestCase.assertNull方法的具体用法?Java TestCase.assertNull怎么用?Java TestCase.assertNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在junit.framework.TestCase的用法示例。


在下文中一共展示了TestCase.assertNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: incCheckNested

import junit.framework.TestCase; //导入方法依赖的package包/类
public static void incCheckNested(String message, Document doc,
        TokenSequence<?> batch, TokenHierarchy<?> batchTH,
        TokenSequence<?> inc, TokenHierarchy<?> incTH
) {
    int i = 0;
    while (inc.moveNext()) {
        TestCase.assertTrue("No more tokens in batch token sequence", batch.moveNext());
        TokenSequence<?> batchE = batch.embedded();
        TokenSequence<?> incE = inc.embedded();
        String messageE = message + "->[" + i + "]";
        if (incE != null) {
            TestCase.assertNotNull("Batch embedded sequence is null", batchE);
            assertTokenSequencesEqual(messageE, batchE, batchTH, incE, incTH, true, true);
            incE.moveStart();
            batchE.moveStart();

            incCheckNested(messageE, doc, batchE, batchTH, incE, incTH);
        } else { // Inc embedded is null
            TestCase.assertNull("Batch embedded sequence non-null", batchE);
        }
        i++;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:LexerTestUtilities.java

示例2: create

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * Tests the constructor.
 */
@Test
public void create() {
    Body b = new Body();

    // these field should be defaulted
    TestCase.assertNotNull(b.getId());
    TestCase.assertNotNull(b.contacts);
    TestCase.assertNotNull(b.getFixtures());
    TestCase.assertNotNull(b.force);
    TestCase.assertNotNull(b.forces);
    TestCase.assertNotNull(b.joints);
    TestCase.assertNotNull(b.mass);
    TestCase.assertNotNull(b.torques);
    TestCase.assertNotNull(b.getTransform());
    TestCase.assertNotNull(b.transform0);
    TestCase.assertNotNull(b.velocity);
    TestCase.assertNull(b.world);
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:22,代码来源:BodyTest.java

示例3: processResponse

import junit.framework.TestCase; //导入方法依赖的package包/类
public synchronized void processResponse(ResponseEvent responseReceived) {
    try {            
        ResponseEventExt responseReceivedEvent = (ResponseEventExt) responseReceived;
        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();     
        this.forkedDialogs.add(dialog);
        if(createDialogAfterRequest) {
            TestCase.assertNull( dialog );
            return;
        } else {
            TestCase.assertNotNull( dialog );
        }
        System.out.println("original Tx " + responseReceivedEvent.getOriginalTransaction());            
        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());
        if ( response.getStatusCode() == Response.OK && cseq.getMethod().equals(Request.INVITE) ) {
            Request ackRequest = dialog.createAck(cseq.getSeqNumber());
            dialog.sendAck(ackRequest);
            this.timer.schedule( new SendBye(dialog),500);
        }
                   
    } catch (Throwable ex) {
        ex.printStackTrace();
        // System.exit(0);
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:40,代码来源:Shootist.java

示例4: assertNull

import junit.framework.TestCase; //导入方法依赖的package包/类
public static void assertNull(String reason, Object thing) {
    if (thing == null) {
        logSuccess("assertNull " + reason);
    } else {
        logFailure(reason);
    }
    TestCase.assertNull(reason, thing);
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:9,代码来源:TestHarness.java

示例5: setUserData

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * Make sure storage of user data is working.
 */
@Test
public void setUserData() {
    Fixture fixture = new Fixture(Geometry.createCircle(1.0));
    // should be initial null
    TestCase.assertNull(fixture.getUserData());

    String obj = "hello";
    fixture.setUserData(obj);
    TestCase.assertNotNull(fixture.getUserData());
    TestCase.assertSame(obj, fixture.getUserData());
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:15,代码来源:FixtureTest.java

示例6: getFoci

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * Tests the getFoci method.
 */
@Test
public void getFoci() {
    Segment s = new Segment(
            new Vector2(0.0, 1.0),
            new Vector2(1.5, 3.0)
    );
    Transform t = new Transform();

    Vector2[] foci = s.getFoci(t);
    TestCase.assertNull(foci);
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:15,代码来源:SegmentTest.java

示例7: getFoci

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * Tests the getFoci method.
 */
@Test
public void getFoci() {
    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);
    Transform t = new Transform();
    // should return none
    Vector2[] foci = p.getFoci(t);
    TestCase.assertNull(foci);
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:17,代码来源:PolygonTest.java

示例8: getAxes

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * Tests the getAxes method.
 */
@Test
public void getAxes() {
    Circle c = new Circle(1.5);
    Transform t = new Transform();
    // a cicle has infinite axes so it should be null
    Vector2[] axes = c.getAxes(null, t);
    TestCase.assertNull(axes);
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:12,代码来源:CircleTest.java

示例9: getUserData

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * Tests the getProperty/set of the user data.
 */
@Test
public void getUserData() {
    String obj = "hello";
    World w = new World();

    TestCase.assertNull(w.getUserData());

    w.setUserData(obj);
    TestCase.assertNotNull(w.getUserData());
    TestCase.assertSame(obj, w.getUserData());
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:15,代码来源:WorldTest.java

示例10: getFixtureByPoint

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * Tests getting fixtures using a world space point.
 *
 * @since 3.1.8
 */
@Test
public void getFixtureByPoint() {
    Body b = new Body();
    b.addFixture(Geometry.createCircle(1.0));
    BodyFixture bf = b.addFixture(Geometry.createUnitCirclePolygon(5, 1.0));
    bf.getShape().translate(0.5, 0);

    // test not in body
    bf = b.getFixture(new Vector2(-1.0, -1.0));
    TestCase.assertNull(bf);

    // confirm there are two fixtures at this location
    TestCase.assertEquals(2, b.getFixtures(new Vector2(0.5, 0.25)).size());

    // test getting the first one
    bf = b.getFixture(new Vector2(0.5, 0.25));
    TestCase.assertNotNull(bf);
    TestCase.assertTrue(bf.getShape() instanceof Circle);

    // test not in body
    List<BodyFixture> bfs = b.getFixtures(new Vector2(-1.0, -1.0));
    TestCase.assertNotNull(bfs);
    TestCase.assertEquals(0, bfs.size());

    // test in body remove one
    bfs = b.getFixtures(new Vector2(1.25, 0.10));
    TestCase.assertNotNull(bfs);
    TestCase.assertEquals(1, bfs.size());
    TestCase.assertTrue(bfs.get(0).getShape() instanceof Polygon);

    // test in body remove both
    bfs = b.getFixtures(new Vector2(0.75, 0.10));
    TestCase.assertNotNull(bfs);
    TestCase.assertEquals(2, bfs.size());
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:41,代码来源:BodyTest.java

示例11: getUserData

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * Make sure the user data is stored.
 */
@Test
public void getUserData() {
    String obj = "hello";
    Body b = new Body();

    TestCase.assertNull(b.getUserData());

    b.setUserData(obj);
    TestCase.assertNotNull(b.getUserData());
    TestCase.assertSame(obj, b.getUserData());
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:15,代码来源:BodyTest.java

示例12: get

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * Tests the getProperty method.
 */
@Test
public void get() {
    TestCase.assertNotNull(tree.get(-3));
    TestCase.assertNull(tree.get(45));
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:9,代码来源:BinarySearchTreeTest.java

示例13: removeBody

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * Tests the remove body method.
 */
@Test
public void removeBody() {
    World w = new World();
    w.setContactManager(new TestContactManager());

    // setup the destruction listener
    WTDestructionListener dl = new WTDestructionListener();
    w.addListener(dl);

    // test removing a null body
    boolean success = w.removeBody((Body) null);
    TestCase.assertFalse(success);

    // test removing a body not in the list
    success = w.removeBody(new Body());
    TestCase.assertFalse(success);

    // setup the bodies
    Convex c1 = Geometry.createCircle(1.0);
    Convex c2 = Geometry.createEquilateralTriangle(0.5);
    Body b1 = new Body();
    b1.addFixture(c1);
    b1.setMass(MassType.NORMAL);
    Body b2 = new Body();
    b2.addFixture(c2);
    b2.setMass(MassType.NORMAL);

    // addChild them to the world
    w.addBody(b1);
    w.addBody(b2);
    // remove one of them
    success = w.removeBody(b1, true);
    TestCase.assertTrue(success);
    TestCase.assertTrue(w.getBodyCount() > 0);
    TestCase.assertNull(b1.world);

    // make sure it was added to the broadphase
    TestCase.assertFalse(w.broadphaseDetector.contains(b1));

    // addChild that one back
    w.addBody(b1);
    TestCase.assertNotNull(b1.world);
    // create a joint
    Joint j = new DistanceJoint(b1, b2, new Vector2(), new Vector2());
    j.setCollisionAllowed(true);
    w.addJoint(j);

    // perform a world step to getProperty contacts
    w.step(1);

    // remove a body and make sure destruction events are called
    w.removeBody(b2, true);
    // make sure it was added to the broadphase
    TestCase.assertFalse(w.broadphaseDetector.contains(b2));
    // make sure the world has zero joints
    TestCase.assertEquals(0, w.getJointCount());
    // make sure the world still has the first body
    TestCase.assertTrue(w.getBodyCount() > 0);
    TestCase.assertEquals(1, w.getBodyCount());
    // make sure it really is the first body
    TestCase.assertSame(b1, w.getBody(0));
    // make sure that the remaining body has no joints attached
    TestCase.assertTrue(b1.joints.isEmpty());
    // make sure that the remaining body has no contacts attached
    TestCase.assertTrue(b1.contacts.isEmpty());
    // make sure the removed body has no joints or contacts
    TestCase.assertTrue(b2.joints.isEmpty());
    TestCase.assertTrue(b2.contacts.isEmpty());
    TestCase.assertNull(b2.world);
    // make sure the destruction listener was called for the one
    // joint and one contact
    TestCase.assertEquals(2, dl.called);
    // the contact manager should not have anything in the cache
    TestCase.assertTrue(((TestContactManager) w.contactManager).cacheSize() == 0);
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:79,代码来源:WorldTest.java

示例14: removeAll

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * Tests the removeAll method.
 */
@Test
public void removeAll() {
    World w = new World();
    w.setContactManager(new TestContactManager());

    // setup the listener
    WTDestructionListener dl = new WTDestructionListener();
    w.addListener(dl);

    // setup the bodies
    Convex c1 = Geometry.createCircle(1.0);
    Convex c2 = Geometry.createEquilateralTriangle(0.5);
    Body b1 = new Body();
    b1.addFixture(c1);
    b1.setMass(MassType.NORMAL);
    Body b2 = new Body();
    b2.addFixture(c2);
    b2.setMass(MassType.NORMAL);

    // setup the joint
    Joint j = new DistanceJoint(b1, b2, new Vector2(), new Vector2());
    j.setCollisionAllowed(true);

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

    // perform a world step to generate contacts
    w.step(1);

    // call the clear method
    w.removeAllBodiesAndJoints(true);

    // verify that it cleared everything and made all the callbacks
    TestCase.assertTrue(b1.contacts.isEmpty());
    TestCase.assertTrue(b1.joints.isEmpty());
    TestCase.assertTrue(b2.contacts.isEmpty());
    TestCase.assertTrue(b2.joints.isEmpty());
    TestCase.assertEquals(0, w.getJointCount());
    TestCase.assertEquals(0, w.getBodyCount());
    TestCase.assertNull(b1.world);
    TestCase.assertNull(b2.world);
    // one contact, one joint, and two bodies
    TestCase.assertEquals(4, dl.called);
    // the contact manager should not have anything in the cache
    TestCase.assertTrue(((TestContactManager) w.contactManager).cacheSize() == 0);
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:51,代码来源:WorldTest.java

示例15: removeAllBodies

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * Tests the removeAllBodies method.
 *
 * @since 3.0.2
 */
@Test
public void removeAllBodies() {
    World w = new World();
    w.setContactManager(new TestContactManager());

    // setup the listener
    WTDestructionListener dl = new WTDestructionListener();
    w.addListener(dl);

    // setup the bodies
    Convex c1 = Geometry.createCircle(1.0);
    Convex c2 = Geometry.createEquilateralTriangle(0.5);
    Body b1 = new Body();
    b1.addFixture(c1);
    b1.setMass(MassType.NORMAL);
    Body b2 = new Body();
    b2.addFixture(c2);
    b2.setMass(MassType.NORMAL);

    // setup the joint
    Joint j = new DistanceJoint(b1, b2, new Vector2(), new Vector2());
    j.setCollisionAllowed(true);

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

    // perform a world step to generate contacts
    w.step(1);

    // call the remove all bodies method
    w.removeAllBodies(true);

    // this method should remove everything because joints cannot exist
    // without the bodies

    // verify that it cleared everything and made all the callbacks
    TestCase.assertTrue(b1.contacts.isEmpty());
    TestCase.assertTrue(b1.joints.isEmpty());
    TestCase.assertTrue(b2.contacts.isEmpty());
    TestCase.assertTrue(b2.joints.isEmpty());
    TestCase.assertEquals(0, w.getJointCount());
    TestCase.assertEquals(0, w.getBodyCount());
    TestCase.assertNull(b1.world);
    TestCase.assertNull(b2.world);
    // one contact, one joint, and two bodies
    TestCase.assertEquals(4, dl.called);
    // the contact manager should not have anything in the cache
    TestCase.assertTrue(((TestContactManager) w.contactManager).cacheSize() == 0);
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:56,代码来源:WorldTest.java


注:本文中的junit.framework.TestCase.assertNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。