### Question:
AtomicNumberRule implements ISequenceSubRule<ILigand> { @Override public int compare(ILigand ligand1, ILigand ligand2) { return getAtomicNumber(ligand1).compareTo(getAtomicNumber(ligand2)); }  @Override int compare(ILigand ligand1, ILigand ligand2);  }### Answer:
@Test public void testCompare_Identity() { ILigand ligand = new Ligand(molecule, new VisitedAtoms(), molecule.getAtom(1), molecule.getAtom(0)); ISequenceSubRule<ILigand> rule = new AtomicNumberRule(); Assert.assertEquals(0, rule.compare(ligand, ligand)); }
@Test public void testCompare() { ILigand ligand1 = new Ligand(molecule, new VisitedAtoms(), molecule.getAtom(1), molecule.getAtom(0)); ILigand ligand2 = new Ligand(molecule, new VisitedAtoms(), molecule.getAtom(1), molecule.getAtom(2)); ISequenceSubRule<ILigand> rule = new AtomicNumberRule(); Assert.assertEquals(-1, rule.compare(ligand1, ligand2)); Assert.assertEquals(1, rule.compare(ligand2, ligand1)); }
@Test public void testImplicitHydrogen_Same() { ILigand ligand1 = new ImplicitHydrogenLigand(molecule, new VisitedAtoms(), molecule.getAtom(1)); ILigand ligand2 = new Ligand(molecule, new VisitedAtoms(), molecule.getAtom(1), molecule.getAtom(4)); ISequenceSubRule<ILigand> rule = new AtomicNumberRule(); Assert.assertEquals(0, rule.compare(ligand1, ligand2)); Assert.assertEquals(0, rule.compare(ligand2, ligand1)); }
@Test public void testImplicitHydrogen() { ILigand ligand1 = new ImplicitHydrogenLigand(molecule, new VisitedAtoms(), molecule.getAtom(1)); ILigand ligand2 = new Ligand(molecule, new VisitedAtoms(), molecule.getAtom(1), molecule.getAtom(3)); ISequenceSubRule<ILigand> rule = new AtomicNumberRule(); Assert.assertEquals(-1, rule.compare(ligand1, ligand2)); Assert.assertEquals(1, rule.compare(ligand2, ligand1)); }