clone.setOfReactions = (IReactionSet) setOfReactions.clone(); } else { clone.setOfReactions = null;
clone.setOfReactions = (IReactionSet) setOfReactions.clone(); } else { clone.setOfReactions = null;
@Test @Override public void testClone() throws Exception { IReactionSet reactionSet = (IReactionSet) newChemObject(); Object clone = reactionSet.clone(); Assert.assertTrue(clone instanceof IReactionSet); }
@Test public void testClone_Reaction() throws Exception { IReactionSet reactionSet = (IReactionSet) newChemObject(); reactionSet.addReaction(reactionSet.getBuilder().newInstance(IReaction.class)); // 1 reactionSet.addReaction(reactionSet.getBuilder().newInstance(IReaction.class)); // 2 reactionSet.addReaction(reactionSet.getBuilder().newInstance(IReaction.class)); // 3 reactionSet.addReaction(reactionSet.getBuilder().newInstance(IReaction.class)); // 4 IReactionSet clone = (IReactionSet) reactionSet.clone(); Assert.assertEquals(reactionSet.getReactionCount(), clone.getReactionCount()); for (int f = 0; f < reactionSet.getReactionCount(); f++) { for (int g = 0; g < clone.getReactionCount(); g++) { Assert.assertNotNull(reactionSet.getReaction(f)); Assert.assertNotNull(clone.getReaction(g)); Assert.assertNotSame(reactionSet.getReaction(f), clone.getReaction(g)); } } }