MolecularFormulaRange implements Cloneable { @Override public Object clone() throws CloneNotSupportedException { MolecularFormulaRange clone = new MolecularFormulaRange(); Iterator<IIsotope> iterIso = this.isotopes().iterator(); while (iterIso.hasNext()) { IIsotope isotope = iterIso.next(); clone.addIsotope((IIsotope) isotope.clone(), getIsotopeCountMin(isotope), getIsotopeCountMax(isotope)); } return clone; } MolecularFormulaRange(); void addIsotope(IIsotope isotope, int countMin, int countMax); boolean contains(IIsotope isotope); int getIsotopeCountMax(IIsotope isotope); int getIsotopeCountMin(IIsotope isotope); int getIsotopeCount(); Iterable<IIsotope> isotopes(); void removeAllIsotopes(); void removeIsotope(IIsotope isotope); @Override Object clone();  }
@Test public void testClone() throws Exception { MolecularFormulaRange mfRange = new MolecularFormulaRange(); Object clone = mfRange.clone(); Assert.assertTrue(clone instanceof MolecularFormulaRange); Assert.assertEquals(mfRange.getIsotopeCount(), ((MolecularFormulaRange) clone).getIsotopeCount()); }