2 package eu
.etaxonomy
.taxeditor
.editor
.name
.operation
;
4 import org
.eclipse
.core
.commands
.ExecutionException
;
5 import org
.junit
.Assert
;
6 import org
.junit
.BeforeClass
;
7 import org
.junit
.Ignore
;
10 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
11 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationship
;
12 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationshipType
;
13 import eu
.etaxonomy
.taxeditor
.editor
.name
.operation
.ChangeConceptRelationshipTypeOperation
;
14 import eu
.etaxonomy
.taxeditor
.store
.operations
.AbstractTaxeditorOperationTestBase
;
17 * Specification for changing the concept relation between two taxa
22 public class ChangeConceptRelationshipTypeOperationTest
extends AbstractTaxeditorOperationTestBase
{
24 private static Taxon relatedTaxon
;
26 private static TaxonRelationshipType oldRelationshipType
;
28 private static TaxonRelationshipType newRelationshipType
;
30 private static TaxonRelationship
[] a
= new TaxonRelationship
[0];
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();
39 taxon
.addTaxonRelation(relatedTaxon
, oldRelationshipType
, null, null);
40 //oldTaxonRelationship = taxon.getTaxonRelations().toArray(a)[0];
42 operation
= new ChangeConceptRelationshipTypeOperation("Change Concept Relation", null, taxon
, relatedTaxon
, newRelationshipType
, postOperation
);
46 @Ignore // Operation not fully implemented
47 public void testExecute() throws ExecutionException
{
48 operation
.execute(monitor
, info
);
50 Assert
.assertEquals(relatedTaxon
, taxon
.getRelationsFromThisTaxon().toArray(a
)[0].getFromTaxon());
51 Assert
.assertEquals(newRelationshipType
, taxon
.getRelationsFromThisTaxon().toArray(a
)[0].getType());
55 @Ignore // Operation not fully implemented
56 public void testUndo() throws ExecutionException
{
57 operation
.undo(monitor
, info
);
59 Assert
.assertEquals(relatedTaxon
, taxon
.getRelationsFromThisTaxon().toArray(a
)[0].getFromTaxon());
60 Assert
.assertEquals(oldRelationshipType
, taxon
.getRelationsFromThisTaxon().toArray(a
)[0].getType());
64 @Ignore // Operation not fully implemented
65 public void testRedo() throws ExecutionException
{
66 operation
.redo(monitor
, info
);
68 Assert
.assertEquals(relatedTaxon
, taxon
.getRelationsFromThisTaxon().toArray(a
)[0].getFromTaxon());
69 Assert
.assertEquals(newRelationshipType
, taxon
.getRelationsFromThisTaxon().toArray(a
)[0].getType());