AtomDiff { public static String diff(IChemObject first, IChemObject second) { IDifference diff = difference(first, second); if (diff == null) { return ""; } else { return diff.toString(); } } private  AtomDiff(); static String diff(IChemObject first, IChemObject second); static IDifference difference(IChemObject first, IChemObject second);  }
@Test public void testMatchAgainstItself() { IAtom atom1 = mock(IAtom.class); String result = AtomDiff.diff(atom1, atom1); assertZeroLength(result); }
@Test public void testDiff() { IAtom atom1 = mock(IAtom.class); IAtom atom2 = mock(IAtom.class); when(atom1.getSymbol()).thenReturn("H"); when(atom2.getSymbol()).thenReturn("C"); String result = AtomDiff.diff(atom1, atom2); Assert.assertNotNull(result); Assert.assertNotSame(0, result.length()); assertContains(result, "AtomDiff"); assertContains(result, "H/C"); }