refactored folder structure
[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 import eu.etaxonomy.taxeditor.operations.ChangeConceptRelationshipTypeOperation;
15
16 /**
17 * Specification for changing the concept relation between two taxa
18 *
19 * @author n.hoffmann
20 * @created 07.04.2009
21 * @version 1.0
22 */
23 public class ChangeConceptRelationshipTypeOperationTest extends AbstractTaxeditorOperationTest {
24
25 private static Taxon relatedTaxon;
26
27 private static TaxonRelationshipType oldRelationshipType;
28
29 private static TaxonRelationshipType newRelationshipType;
30
31 private static TaxonRelationship[] a = new TaxonRelationship[0];
32
33 @BeforeClass
34 public static void setUpBeforeClass() throws Exception {
35 taxon = Taxon.NewInstance(null, null);
36 relatedTaxon = Taxon.NewInstance(null, null);
37 oldRelationshipType = TaxonRelationshipType.OVERLAPS();
38 newRelationshipType = TaxonRelationshipType.OVERLAPS_OR_EXCLUDES();
39
40 taxon.addTaxonRelation(relatedTaxon, oldRelationshipType, null, null);
41 //oldTaxonRelationship = taxon.getTaxonRelations().toArray(a)[0];
42
43 operation = new ChangeConceptRelationshipTypeOperation("Change Concept Relation", null, taxon, relatedTaxon, newRelationshipType, postOperation);
44 }
45
46 @Test
47 @Ignore // Operation not fully implemented
48 public void testExecute() throws ExecutionException {
49 operation.execute(monitor, info);
50
51 Assert.assertEquals(relatedTaxon, taxon.getRelationsFromThisTaxon().toArray(a)[0].getFromTaxon());
52 Assert.assertEquals(newRelationshipType, taxon.getRelationsFromThisTaxon().toArray(a)[0].getType());
53 }
54
55 @Test
56 @Ignore // Operation not fully implemented
57 public void testUndo() throws ExecutionException {
58 operation.undo(monitor, info);
59
60 Assert.assertEquals(relatedTaxon, taxon.getRelationsFromThisTaxon().toArray(a)[0].getFromTaxon());
61 Assert.assertEquals(oldRelationshipType, taxon.getRelationsFromThisTaxon().toArray(a)[0].getType());
62 }
63
64 @Test
65 @Ignore // Operation not fully implemented
66 public void testRedo() throws ExecutionException {
67 operation.redo(monitor, info);
68
69 Assert.assertEquals(relatedTaxon, taxon.getRelationsFromThisTaxon().toArray(a)[0].getFromTaxon());
70 Assert.assertEquals(newRelationshipType, taxon.getRelationsFromThisTaxon().toArray(a)[0].getType());
71 }
72
73 }