2 package eu
.etaxonomy
.taxeditor
.store
.operations
;
4 import junit
.framework
.Assert
;
6 import org
.eclipse
.core
.commands
.ExecutionException
;
7 import org
.junit
.BeforeClass
;
8 import org
.junit
.Ignore
;
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
;
17 * Specification for changing the concept relation between two taxa
23 public class ChangeConceptRelationshipTypeOperationTest
extends AbstractTaxeditorOperationTest
{
25 private static Taxon relatedTaxon
;
27 private static TaxonRelationshipType oldRelationshipType
;
29 private static TaxonRelationshipType newRelationshipType
;
31 private static TaxonRelationship
[] a
= new TaxonRelationship
[0];
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();
40 taxon
.addTaxonRelation(relatedTaxon
, oldRelationshipType
, null, null);
41 //oldTaxonRelationship = taxon.getTaxonRelations().toArray(a)[0];
43 operation
= new ChangeConceptRelationshipTypeOperation("Change Concept Relation", null, taxon
, relatedTaxon
, newRelationshipType
, postOperation
);
47 @Ignore // Operation not fully implemented
48 public void testExecute() throws ExecutionException
{
49 operation
.execute(monitor
, info
);
51 Assert
.assertEquals(relatedTaxon
, taxon
.getRelationsFromThisTaxon().toArray(a
)[0].getFromTaxon());
52 Assert
.assertEquals(newRelationshipType
, taxon
.getRelationsFromThisTaxon().toArray(a
)[0].getType());
56 @Ignore // Operation not fully implemented
57 public void testUndo() throws ExecutionException
{
58 operation
.undo(monitor
, info
);
60 Assert
.assertEquals(relatedTaxon
, taxon
.getRelationsFromThisTaxon().toArray(a
)[0].getFromTaxon());
61 Assert
.assertEquals(oldRelationshipType
, taxon
.getRelationsFromThisTaxon().toArray(a
)[0].getType());
65 @Ignore // Operation not fully implemented
66 public void testRedo() throws ExecutionException
{
67 operation
.redo(monitor
, info
);
69 Assert
.assertEquals(relatedTaxon
, taxon
.getRelationsFromThisTaxon().toArray(a
)[0].getFromTaxon());
70 Assert
.assertEquals(newRelationshipType
, taxon
.getRelationsFromThisTaxon().toArray(a
)[0].getType());