IsotopeContainer { @Override public Object clone() throws CloneNotSupportedException { IsotopeContainer isoClone = new IsotopeContainer(); isoClone.forms.addAll(getFormulas()); isoClone.setIntensity(getIntensity()); isoClone.setMass(getMass()); return isoClone; } IsotopeContainer();  IsotopeContainer(IMolecularFormula formula, double intensity);  IsotopeContainer(double mass, double intensity);  IsotopeContainer(IsotopeContainer container); void setFormula(IMolecularFormula formula); void addFormula(IMolecularFormula formula); void setMass(double mass); void setIntensity(double intensity); IMolecularFormula getFormula(); List<IMolecularFormula> getFormulas(); double getMass(); double getIntensity(); @Override Object clone(); @Override String toString();  }
@Test public void testClone() throws Exception { IsotopeContainer isoC = new IsotopeContainer(); IMolecularFormula formula = builder.newInstance(IMolecularFormula.class); isoC.setFormula(formula); double mass = 130.00; isoC.setMass(mass); double intensity = 130.00; isoC.setIntensity(intensity); IsotopeContainer clone = (IsotopeContainer) isoC.clone(); Assert.assertEquals(mass, clone.getMass(), 0.001); Assert.assertEquals(intensity, clone.getIntensity(), 0.001); Assert.assertEquals(formula, clone.getFormula()); }