editor now updatable via updateSite
[taxeditor.git] / taxeditor-store / src / test / java / eu / etaxonomy / taxeditor / store / operations / ChangeConceptRelationshipTypeOperationTest.java
1
2 package eu.etaxonomy.taxeditor.store.operations;
3
4 import junit.framework.Assert;
5
6 import org.eclipse.core.commands.ExecutionException;
7 import org.junit.BeforeClass;
8 import org.junit.Ignore;
9 import org.junit.Test;
10
11 import eu.etaxonomy.cdm.model.taxon.Taxon;
12 import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
13 import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
14
15 /**
16 * Specification for changing the concept relation between two taxa
17 *
18 * @author n.hoffmann
19 * @created 07.04.2009
20 * @version 1.0
21 */
22 public class ChangeConceptRelationshipTypeOperationTest extends AbstractTaxeditorOperationTest {
23
24 private static Taxon relatedTaxon;
25
26 private static TaxonRelationshipType oldRelationshipType;
27
28 private static TaxonRelationshipType newRelationshipType;
29
30 private static TaxonRelationship[] a = new TaxonRelationship[0];
31
32 @BeforeClass
33 public static void setUpBeforeClass() throws Exception {
34 taxon = Taxon.NewInstance(null, null);
35 relatedTaxon = Taxon.NewInstance(null, null);
36 oldRelationshipType = TaxonRelationshipType.OVERLAPS();
37 newRelationshipType = TaxonRelationshipType.OVERLAPS_OR_EXCLUDES();
38
39 taxon.addTaxonRelation(relatedTaxon, oldRelationshipType, null, null);
40 //oldTaxonRelationship = taxon.getTaxonRelations().toArray(a)[0];
41
42 operation = new ChangeConceptRelationshipTypeOperation("Change Concept Relation", null, taxon, relatedTaxon, newRelationshipType, postOperation);
43 }
44
45 @Test
46 @Ignore // Operation not fully implemented
47 public void testExecute() throws ExecutionException {
48 operation.execute(monitor, info);
49
50 Assert.assertEquals(relatedTaxon, taxon.getRelationsFromThisTaxon().toArray(a)[0].getFromTaxon());
51 Assert.assertEquals(newRelationshipType, taxon.getRelationsFromThisTaxon().toArray(a)[0].getType());
52 }
53
54 @Test
55 @Ignore // Operation not fully implemented
56 public void testUndo() throws ExecutionException {
57 operation.undo(monitor, info);
58
59 Assert.assertEquals(relatedTaxon, taxon.getRelationsFromThisTaxon().toArray(a)[0].getFromTaxon());
60 Assert.assertEquals(oldRelationshipType, taxon.getRelationsFromThisTaxon().toArray(a)[0].getType());
61 }
62
63 @Test
64 @Ignore // Operation not fully implemented
65 public void testRedo() throws ExecutionException {
66 operation.redo(monitor, info);
67
68 Assert.assertEquals(relatedTaxon, taxon.getRelationsFromThisTaxon().toArray(a)[0].getFromTaxon());
69 Assert.assertEquals(newRelationshipType, taxon.getRelationsFromThisTaxon().toArray(a)[0].getType());
70 }
71
72 }