ChemObjectDiff { public static String diff(IChemObject first, IChemObject second) { IDifference difference = difference(first, second); if (difference == null) { return ""; } else { return difference.toString(); } } private  ChemObjectDiff(); static String diff(IChemObject first, IChemObject second); static IDifference difference(IChemObject first, IChemObject second);  }
@Test public void testDiff() { IChemObject atom1 = mock(IChemObject.class); IChemObject atom2 = mock(IChemObject.class); when(atom1.getFlags()).thenReturn(new boolean[]{false, false, false}); when(atom2.getFlags()).thenReturn(new boolean[]{false, true, false}); String result = ChemObjectDiff.diff(atom1, atom2); Assert.assertNotNull(result); Assert.assertNotSame("Expected non-zero-length result", 0, result.length()); assertContains(result, "ChemObjectDiff"); assertContains(result, "F/T"); }
@Test public void testMatchAgainstItself() { IChemObject atom1 = mock(IChemObject.class); String result = ChemObjectDiff.diff(atom1, atom1); assertZeroLength(result); }