import junit.framework.Assert;\r
\r
import org.apache.log4j.Logger;\r
-import org.junit.Ignore;\r
import org.junit.Test;\r
import org.unitils.dbunit.annotation.DataSet;\r
import org.unitils.spring.annotation.SpringBeanByType;\r
}\r
\r
@Test\r
-// @Ignore // Remove when implemented\r
public void testMoveDescriptionElementsToTaxon(){\r
\r
TaxonDescription sourceDescription = TaxonDescription.NewInstance();\r
Assert.assertEquals(3, sourceDescription.getElements().size());\r
\r
TaxonDescription targetDescription = TaxonDescription.NewInstance();\r
+ this.service.save(sourceDescription);\r
+ this.service.save(targetDescription);\r
\r
service.moveDescriptionElementsToDescription(sourceCollection, targetDescription, false);\r
\r
Assert.assertTrue("The moved element2 should be in the new description", targetDescription.getElements().contains(element2));\r
Assert.assertFalse("Element3 should not be in the new description", targetDescription.getElements().contains(element3));\r
Assert.assertTrue("Element3 should remain in the old description", targetDescription.getElements().contains(element));\r
-\r
+ this.service.save(sourceDescription);\r
+ this.service.save(targetDescription);\r
+ \r
try {\r
service.moveDescriptionElementsToDescription(targetDescription.getElements(), sourceDescription, false);\r
} catch (Exception e) {\r
\r
Assert.assertEquals("Source descirption should have 3 elements again", 3, sourceDescription.getElements().size());\r
Assert.assertEquals("Destination descirption should have no elements again", 0, targetDescription.getElements().size());\r
+ this.service.save(sourceDescription);\r
+ this.service.save(targetDescription);\r
\r
//test paste\r
sourceCollection.add(sourceDescription.getElements().iterator().next());\r
for (DescriptionElementBase targetElement : targetDescription.getElements()){\r
Assert.assertFalse("Target elements may not be in sourced description as they are only clones (but not same).", sourceDescription.getElements().contains(targetElement));\r
}\r
+ this.service.save(targetDescription);\r
+ this.service.save(sourceDescription);\r
+ \r
\r
}\r
}\r