本文整理匯總了Java中junit.framework.TestCase.assertNotSame方法的典型用法代碼示例。如果您正苦於以下問題:Java TestCase.assertNotSame方法的具體用法?Java TestCase.assertNotSame怎麽用?Java TestCase.assertNotSame使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類junit.framework.TestCase
的用法示例。
在下文中一共展示了TestCase.assertNotSame方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateLarge
import junit.framework.TestCase; //導入方法依賴的package包/類
/**
* Tests the update method where the collidable moves enough to update the AABB.
*/
@Test
public void updateLarge() {
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);
// make sure they are there
AABB aabbSap = this.sap.getAABB(ct, f);
AABB aabbDyn = this.dyn.getAABB(ct, f);
// move the collidable a bit
ct.translate(0.5, 0.0);
// update the broadphases
this.sap.update(ct);
this.dyn.update(ct);
// the aabbs should not have been updated because of the expansion code
TestCase.assertNotSame(aabbSap, this.sap.getAABB(ct, f));
TestCase.assertNotSame(aabbDyn, this.dyn.getAABB(ct, f));
}
示例2: setTransform
import junit.framework.TestCase; //導入方法依賴的package包/類
/**
* Tests the setTransform method.
*/
@Test
public void setTransform() {
Transform tx = new Transform();
tx.rotate(Math.toRadians(30));
tx.translate(2.0, 0.5);
Transform tx2 = new Transform();
tx2.set(tx);
// shouldnt be the same object reference
TestCase.assertNotSame(tx2, tx);
// should be the same transformation
TestCase.assertEquals(tx.m00, tx2.m00);
TestCase.assertEquals(tx.m01, tx2.m01);
TestCase.assertEquals(tx.m10, tx2.m10);
TestCase.assertEquals(tx.m11, tx2.m11);
TestCase.assertEquals(tx.x, tx2.x);
TestCase.assertEquals(tx.y, tx2.y);
}
示例3: translate
import junit.framework.TestCase; //導入方法依賴的package包/類
/**
* Tests the translate method.
*
* @since 3.1.0
*/
@Test
public void translate() {
AABB aabb = new AABB(-2.0, 0.0, 1.0, 1.0);
AABB aabb2 = aabb.getTranslated(new Vector2(-1.0, 2.0));
TestCase.assertNotSame(aabb, aabb2);
TestCase.assertEquals(-2.0, aabb.getMinX(), 1.0E-4);
TestCase.assertEquals(0.0, aabb.getMinY(), 1.0E-4);
TestCase.assertEquals(1.0, aabb.getMaxX(), 1.0E-4);
TestCase.assertEquals(1.0, aabb.getMaxY(), 1.0E-4);
TestCase.assertEquals(-3.0, aabb2.getMinX(), 1.0E-4);
TestCase.assertEquals(2.0, aabb2.getMinY(), 1.0E-4);
TestCase.assertEquals(0.0, aabb2.getMaxX(), 1.0E-4);
TestCase.assertEquals(3.0, aabb2.getMaxY(), 1.0E-4);
aabb.translate(new Vector2(-1.0, 2.0));
TestCase.assertEquals(-3.0, aabb.getMinX(), 1.0E-4);
TestCase.assertEquals(2.0, aabb.getMinY(), 1.0E-4);
TestCase.assertEquals(0.0, aabb.getMaxX(), 1.0E-4);
TestCase.assertEquals(3.0, aabb.getMaxY(), 1.0E-4);
}
示例4: createListOneElement
import junit.framework.TestCase; //導入方法依賴的package包/類
/**
* Test the create method accepting a list of one mass.
*
* @since 2.0.0
*/
@Test
public void createListOneElement() {
Mass m1 = new Mass(new Vector2(), 1.0, 2.0);
List<Mass> masses = new ArrayList<Mass>();
masses.add(m1);
Mass m = Mass.create(masses);
Vector2 c = m.getCenter();
TestCase.assertFalse(m.isInfinite());
TestCase.assertNotSame(m1, m);
TestCase.assertEquals(0.000, c.x, 1.0e-3);
TestCase.assertEquals(0.000, c.y, 1.0e-3);
TestCase.assertEquals(1.000, m.getMass(), 1.0e-3);
TestCase.assertEquals(2.000, m.getInertia(), 1.0e-3);
}
示例5: createSuccess
import junit.framework.TestCase; //導入方法依賴的package包/類
/**
* Tests successful creation.
*/
@Test
public void createSuccess() {
Force f = new Force();
f = new Force(0.3, 2.0);
TestCase.assertEquals(0.3, f.force.x);
TestCase.assertEquals(2.0, f.force.y);
Force f2 = new Force(f);
TestCase.assertEquals(0.3, f.force.x);
TestCase.assertEquals(2.0, f.force.y);
TestCase.assertNotSame(f.force, f2.force);
f = new Force(new Vector2(2.0, 1.0));
TestCase.assertEquals(2.0, f.force.x);
TestCase.assertEquals(1.0, f.force.y);
}
示例6: setSuccess
import junit.framework.TestCase; //導入方法依賴的package包/類
/**
* Tests the set methods successfully.
*/
@Test
public void setSuccess() {
Force f = new Force();
f.set(3.0, -2.0);
TestCase.assertEquals(3.0, f.force.x);
TestCase.assertEquals(-2.0, f.force.y);
f.set(new Vector2(2.0, 1.0));
TestCase.assertEquals(2.0, f.force.x);
TestCase.assertEquals(1.0, f.force.y);
Force f2 = new Force(0.5, -2.0);
f.set(f2);
TestCase.assertEquals(0.5, f.force.x);
TestCase.assertEquals(-2.0, f.force.y);
TestCase.assertNotSame(f.force, f2.force);
}
示例7: createCopy
import junit.framework.TestCase; //導入方法依賴的package包/類
/**
* Tests the successful copy of an AABB.
*/
@Test
public void createCopy() {
AABB aabb1 = new AABB(new Vector2(-3.0, 0.0), new Vector2(-2.0, 2.0));
AABB aabb2 = new AABB(aabb1);
TestCase.assertNotSame(aabb1, aabb2);
TestCase.assertEquals(aabb1.getMinX(), aabb2.getMinX(), 1.0E-4);
TestCase.assertEquals(aabb1.getMinY(), aabb2.getMinY(), 1.0E-4);
TestCase.assertEquals(aabb1.getMaxX(), aabb2.getMaxX(), 1.0E-4);
TestCase.assertEquals(aabb1.getMaxY(), aabb2.getMaxY(), 1.0E-4);
}
示例8: createCopy
import junit.framework.TestCase; //導入方法依賴的package包/類
/**
* Test the create method.
*
* @since 2.0.0
*/
@Test
public void createCopy() {
Mass m = new Mass(new Vector2(1.0, 0.0), 2.0, 1.0);
Mass m2 = new Mass(m);
TestCase.assertNotSame(m, m2);
TestCase.assertNotSame(m.center, m2.center);
TestCase.assertEquals(m.center.x, m2.center.x);
TestCase.assertEquals(m.center.y, m2.center.y);
TestCase.assertEquals(m.getMass(), m2.getMass());
TestCase.assertEquals(m.getInertia(), m2.getInertia());
TestCase.assertEquals(m.getType(), m2.getType());
}
示例9: createCopy
import junit.framework.TestCase; //導入方法依賴的package包/類
/**
* Tests the copy constructor.
*/
@Test
public void createCopy() {
Interval i1 = new Interval(-1.0, 2.0);
Interval i2 = new Interval(i1);
TestCase.assertNotSame(i2, i1);
TestCase.assertEquals(i1.min, i2.min);
TestCase.assertEquals(i1.max, i2.max);
}
示例10: expand
import junit.framework.TestCase; //導入方法依賴的package包/類
/**
* Tests the expand method.
*/
@Test
public void expand() {
AABB aabb = new AABB(-2.0, 0.0, 4.0, 4.0);
AABB aabb2 = aabb.getExpanded(2.0);
TestCase.assertNotSame(aabb, aabb2);
aabb.expand(1.0);
TestCase.assertEquals(-2.5, aabb.getMinX(), 1.0E-4);
TestCase.assertEquals(-0.5, aabb.getMinY(), 1.0E-4);
TestCase.assertEquals(4.5, aabb.getMaxX(), 1.0E-4);
TestCase.assertEquals(4.5, aabb.getMaxY(), 1.0E-4);
// the second aabb will have different values
TestCase.assertEquals(-3.0, aabb2.getMinX(), 1.0E-4);
TestCase.assertEquals(-1.0, aabb2.getMinY(), 1.0E-4);
TestCase.assertEquals(5.0, aabb2.getMaxX(), 1.0E-4);
TestCase.assertEquals(5.0, aabb2.getMaxY(), 1.0E-4);
// test negative expansion
aabb2 = aabb.getExpanded(-1.0);
TestCase.assertEquals(-2.0, aabb2.getMinX(), 1.0E-4);
TestCase.assertEquals(0.0, aabb2.getMinY(), 1.0E-4);
TestCase.assertEquals(4.0, aabb2.getMaxX(), 1.0E-4);
TestCase.assertEquals(4.0, aabb2.getMaxY(), 1.0E-4);
aabb.expand(-1.0);
TestCase.assertEquals(-2.0, aabb.getMinX(), 1.0E-4);
TestCase.assertEquals(0.0, aabb.getMinY(), 1.0E-4);
TestCase.assertEquals(4.0, aabb.getMaxX(), 1.0E-4);
TestCase.assertEquals(4.0, aabb.getMaxY(), 1.0E-4);
// test an overly negative expansion
aabb2 = aabb.getExpanded(-8.0);
TestCase.assertEquals(1.0, aabb2.getMinX(), 1.0E-4);
TestCase.assertEquals(2.0, aabb2.getMinY(), 1.0E-4);
TestCase.assertEquals(1.0, aabb2.getMaxX(), 1.0E-4);
TestCase.assertEquals(2.0, aabb2.getMaxY(), 1.0E-4);
aabb.expand(-8.0);
TestCase.assertEquals(1.0, aabb.getMinX(), 1.0E-4);
TestCase.assertEquals(2.0, aabb.getMinY(), 1.0E-4);
TestCase.assertEquals(1.0, aabb.getMaxX(), 1.0E-4);
TestCase.assertEquals(2.0, aabb.getMaxY(), 1.0E-4);
}