@Test @Override public void testClone() throws Exception { IChemFile file = (IChemFile) newChemObject(); Object clone = file.clone(); Assert.assertTrue(clone instanceof IChemFile); }
@Test public void testClone_ChemSequence() throws Exception { IChemFile file = (IChemFile) newChemObject(); file.addChemSequence(file.getBuilder().newInstance(IChemSequence.class)); // 1 file.addChemSequence(file.getBuilder().newInstance(IChemSequence.class)); // 2 file.addChemSequence(file.getBuilder().newInstance(IChemSequence.class)); // 3 file.addChemSequence(file.getBuilder().newInstance(IChemSequence.class)); // 4 IChemFile clone = (IChemFile) file.clone(); Assert.assertEquals(file.getChemSequenceCount(), clone.getChemSequenceCount()); for (int f = 0; f < file.getChemSequenceCount(); f++) { for (int g = 0; g < clone.getChemSequenceCount(); g++) { Assert.assertNotNull(file.getChemSequence(f)); Assert.assertNotNull(clone.getChemSequence(g)); Assert.assertNotSame(file.getChemSequence(f), clone.getChemSequence(g)); } } } }