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


Java TestCase.assertSame方法代码示例

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


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

示例1: processAck

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * Handle an incoming ACK.
 *
 * @param request
 * @param tid
 */

public void processAck(Request request, ServerTransaction tid) {
    try {
        logger.info("Got an ACK! sending bye : " + tid);
        if (tid != null) {
            Dialog dialog = tid.getDialog();

            TestCase.assertSame("Dialog mismatch",dialog, this.dialog);


            Request bye = dialog.createRequest(Request.BYE);
            logger.info("bye request = " + bye);
            MaxForwardsHeader mf = ProtocolObjects.headerFactory
                    .createMaxForwardsHeader(10);
            bye.addHeader(mf);
            ClientTransaction ct = provider.getNewClientTransaction(bye);
            dialog.sendRequest(ct);
        }
    } catch (Exception ex) {
        ex.printStackTrace();
        System.exit(0);
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:30,代码来源:Shootist.java

示例2: processTimeout

import junit.framework.TestCase; //导入方法依赖的package包/类
public void processTimeout(TimeoutEvent timeoutEvent) {
    this.timeoutSeen = true;
    ClientTransaction ctx = timeoutEvent.getClientTransaction();
    TestCase.assertSame("Should see a timeout for INVITE", ctx,
            this.inviteTid);
    TestCase.assertEquals("Should be in proceeding state",
            TransactionState.PROCEEDING, ctx.getState());
    try {
        Request cancelRequest = timeoutEvent.getClientTransaction()
                .createCancel();
        ClientTransaction cancelTx = this.provider
                .getNewClientTransaction(cancelRequest);
        cancelTx.sendRequest();
    } catch (Exception ex) {
        logger.error("Unexpected exception", ex);
        TestCase.fail("Unexpected exception");
    }

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

示例3: addRemoveCondition

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * Tests adding and removing a fallback condition.
 */
@Test
public void addRemoveCondition() {
    FallbackNarrowphaseDetector detector = new FallbackNarrowphaseDetector(new Sat(), new Gjk());
    FallbackCondition condition = new SingleTypedFallbackCondition(Capsule.class);
    detector.addCondition(condition);
    TestCase.assertTrue(detector.containsCondition(condition));
    TestCase.assertEquals(1, detector.getConditionCount());
    TestCase.assertSame(condition, detector.getCondition(0));

    // verify the equals is working as expected
    TestCase.assertEquals(condition, new SingleTypedFallbackCondition(Capsule.class));
    TestCase.assertFalse(condition.equals(new SingleTypedFallbackCondition(Capsule.class, false)));
    TestCase.assertFalse(condition.equals(new SingleTypedFallbackCondition(Capsule.class, 1)));

    TestCase.assertTrue(detector.removeCondition(condition));
    TestCase.assertEquals(0, detector.getConditionCount());
    TestCase.assertFalse(detector.containsCondition(condition));
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:22,代码来源:FallbackNarrowphaseDetectorTest.java

示例4: updateSmall

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * Tests the update method where the collidable moves very little.
 */
@Test
public void updateSmall() {
    CollidableTest ct = new CollidableTest(Geometry.createCircle(1.0));
    Fixture f = ct.getFixture(0);

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

    // getProperty the current aabb
    AABB aabbSap = this.sap.getAABB(ct, f);
    AABB aabbDyn = this.dyn.getAABB(ct, f);

    // move the collidable a bit
    ct.translate(0.05, 0.0);

    // update the broadphases
    this.sap.update(ct, f);
    this.dyn.update(ct, f);

    // the aabbs should not have been updated because of the expansion code
    TestCase.assertSame(aabbSap, this.sap.getAABB(ct, f));
    TestCase.assertSame(aabbDyn, this.dyn.getAABB(ct, f));
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:28,代码来源:BroadphaseTest.java

示例5: setCoefficientMixer

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * Tests the set coefficient mixer method.
 */
@Test
public void setCoefficientMixer() {
    World w = new World();
    CoefficientMixer cm = new CoefficientMixer() {
        @Override
        public double mixRestitution(double restitution1, double restitution2) {
            return (restitution1 + restitution2) * 0.5;
        }

        @Override
        public double mixFriction(double friction1, double friction2) {
            return (friction1 + friction2) * 0.5;
        }
    };
    w.setCoefficientMixer(cm);

    TestCase.assertSame(cm, w.getCoefficientMixer());
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:22,代码来源:WorldTest.java

示例6: getJoinedBodies

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * 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));
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:25,代码来源:BodyTest.java

示例7: getJoints

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

    List<Joint> joints = b1.getJoints();
    TestCase.assertNotNull(joints);
    TestCase.assertTrue(joints.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);

    joints = b1.getJoints();
    TestCase.assertNotNull(joints);
    TestCase.assertFalse(joints.isEmpty());
    TestCase.assertSame(j, joints.get(0));
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:25,代码来源:BodyTest.java

示例8: assertSame

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

示例9: 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

示例10: singleTypedConditionOrder

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * Test that fallback checking based on order.
 */
@Test
public void singleTypedConditionOrder() {
    FallbackNarrowphaseDetector detector = new FallbackNarrowphaseDetector(new Sat(), new Gjk());
    // try strict mode
    FallbackCondition c1 = new SingleTypedFallbackCondition(Polygon.class, 1, true);
    FallbackCondition c2 = new SingleTypedFallbackCondition(Rectangle.class, 0, true);
    detector.addCondition(c1);
    detector.addCondition(c2);

    // make sure the sorting works
    TestCase.assertSame(detector.getCondition(0), c2);

    // 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].getClass() == Polygon.class || TYPES[j].getClass() == Polygon.class ||
                    TYPES[i].getClass() == Rectangle.class || TYPES[j].getClass() == Rectangle.class) {
                // any combo with specifically a Polygon (so not Rectangle, Triangle, etc. since
                // we are using strict mode) should fallback
                TestCase.assertTrue(fallback);
            } else {
                // all other combos shouldn't
                TestCase.assertFalse(fallback);
            }
        }
    }
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:32,代码来源:FallbackNarrowphaseDetectorTest.java

示例11: setDistanceDetector

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * Tests the set distance detector method.
 */
@Test
public void setDistanceDetector() {
    DistanceDetector dd = new Gjk();
    this.detector.setDistanceDetector(dd);

    TestCase.assertSame(dd, this.detector.getDistanceDetector());
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:11,代码来源:ConservativeAdvancementTest.java

示例12: setGravity

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * Tests the set gravity method.
 */
@Test
public void setGravity() {
    World w = new World();
    Vector2 g = new Vector2(0.0, -10.0);
    w.setGravity(g);
    TestCase.assertSame(g, w.gravity);
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:11,代码来源:WorldTest.java

示例13: addListener

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * 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));
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:12,代码来源:WorldTest.java

示例14: setBroadphaseDetector

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * Tests the set broadphase detector method.
 */
@Test
public void setBroadphaseDetector() {
    World w = new World();
    Body b = new Body();
    b.addFixture(Geometry.createCircle(1.0));
    w.addBody(b);
    BroadphaseDetector<Body, BodyFixture> bd = new Sap<Body, BodyFixture>();
    w.setBroadphaseDetector(bd);
    TestCase.assertSame(bd, w.getBroadphaseDetector());
    // test bodies are re-added
    TestCase.assertTrue(w.broadphaseDetector.contains(b));
    TestCase.assertTrue(w.broadphaseDetector.contains(b, b.getFixture(0)));
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:17,代码来源:WorldTest.java

示例15: setNarrowphaseDetector

import junit.framework.TestCase; //导入方法依赖的package包/类
/**
 * Tests the set narrowphase detector method.
 */
@Test
public void setNarrowphaseDetector() {
    World w = new World();
    NarrowphaseDetector nd = new Gjk();
    w.setNarrowphaseDetector(nd);

    TestCase.assertSame(nd, w.getNarrowphaseDetector());
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:12,代码来源:WorldTest.java


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