CameraDataValueEq implements IValueEq<CameraData> { @Override public boolean equal(CameraData a, CameraData b) { return same(a.getDirection(), b.getDirection()) && same(a.getFieldWidth(), b.getFieldWidth()) && same(a.getFocus(), b.getFocus()) && same(a.getHeading(), b.getHeading()) && same(a.getImageReference(), b.getImageReference()) && same(a.getIris(), b.getIris()) && same(a.getName(), b.getName()) && same(a.getPitch(), b.getPitch()) && same(a.getRoll(), b.getRoll()) && same(a.getViewHeight(), b.getViewHeight()) && same(a.getViewUnits(), b.getViewUnits()) && same(a.getViewWidth(), b.getViewWidth()) && same(a.getX(), b.getX()) && same(a.getXYUnits(), b.getXYUnits()) && same(a.getY(), b.getY()) && same(a.getZ(), b.getZ()) && same(a.getZoom(), b.getZoom()) && same(a.getZUnits(), b.getZUnits()); } CameraDataValueEq(double eps);  CameraDataValueEq(); @Override boolean equal(CameraData a, CameraData b);  }
@Test public void identityTest() { IValueEq<CameraData> eq = new CameraDataValueEq(); CameraData a = new ImmutableCameraData(null, "a", 1D, 2, 3F, "aa", 4, null, "aaa", 5F, 6F, 7F, 8F, "aaaa", 9F, "aaaaa", 10F, 11F, "aaaaaa", 12); assertTrue(eq.equal(a, a)); }
@Test public void nullValueTest() { IValueEq<CameraData> eq = new CameraDataValueEq(); CameraData a = new ImmutableCameraData(null, "a", 1D, 2, 3F, "aa", 4, null, "aaa", 5F, 6F, 7F, 8F, "aaaa", 9F, "aaaaa", 10F, 11F, "aaaaaa", 12); CameraData b = new ImmutableCameraData(null, "a", null, 2, 3F, "aa", 4, null, "aaa", 5F, 6F, 7F, 8F, "aaaa", 9F, "aaaaa", 10F, 11F, "aaaaaa", 12); assertFalse(eq.equal(a, b)); }
@Test public void toleranceTest1() { IValueEq<CameraData> eq = new CameraDataValueEq(); CameraData a = new ImmutableCameraData(null, "a", 1D, 2, 3F, "aa", 4, null, "aaa", 5F, 6F, 7F, 8F, "aaaa", 9F, "aaaaa", 10F, 11F, "aaaaaa", 12); CameraData b = new ImmutableCameraData(null, "a", 1.01, 2, 3F, "aa", 4, null, "aaa", 5F, 6F, 7F, 8F, "aaaa", 9F, "aaaaa", 10F, 11F, "aaaaaa", 12); assertFalse(eq.equal(a, b)); }
@Test public void toleranceTest2() { IValueEq<CameraData> eq = new CameraDataValueEq(0.02); CameraData a = new ImmutableCameraData(null, "a", 1D, 2, 3F, "aa", 4, null, "aaa", 5F, 6F, 7F, 8F, "aaaa", 9F, "aaaaa", 10F, 11F, "aaaaaa", 12); CameraData b = new ImmutableCameraData(null, "a", 1.01, 2, 3F, "aa", 4, null, "aaa", 5F, 6F, 7F, 8F, "aaaa", 9F, "aaaaa", 10F, 11F, "aaaaaa", 12); assertTrue(eq.equal(a, b)); }