我刚刚迁移到更新版本的JUnit,其中Assert.assertNotEquals已被删除,所以现在我正在努力重写一个测试。断言在junit中float的不等式
原始代码:
Double givenLongitude = new Double(13);
assertNotEquals(givenLongitude, extract("position.longitude", eventDataJson, Float.class), 0.01d);
凡提取方法是,在这种情况下,返回浮动的通用方法。
我的问题是,我想用Assert.assertFalse这样
Double givenLongitude = new Double(13);
assertFalse(givenLongitude.equals(extract("position.longitude", eventDataJson, Float.class)), 0.01d);
但由于assertFalse可是没有delta值我不确定如何没有败诉的delta值做到这一点比较呢?有什么建议么?
为什么您认为assertNotEquals不再存在?我刚刚检查了4.11源代码,它仍然存在 – mikea
我正在使用4.8版本。 – Marthin
哇,你是对的。真奇怪。 4.6(我正在使用)有。 4.11有它。看起来他们放弃了它,然后在4.11中再次放回。你可以尝试转向它,它在maven中心。 – mikea