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