assertj中assertThat方法比较对象里包含double类型

为数组/对象中的double类型值的比较设置允许误差范围1.0e-6(0.000001)

​
assertThat(ret).usingRecursiveComparison()
            .withComparatorForType(new DoubleComparator(1.0e-6), Double.class)
            .isEqualTo(expected);

​

你可能感兴趣的:(JAVA,测试,java,单元测试,assertj)