2 package eu
.etaxonomy
.taxeditor
.editor
.name
.operation
;
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
.editor
.name
.operation
.ChangeConceptRelationshipTypeOperation
;
15 import eu
.etaxonomy
.taxeditor
.store
.operations
.AbstractTaxeditorOperationTest
;
18 * Specification for changing the concept relation between two taxa
24 public class ChangeConceptRelationshipTypeOperationTest
extends AbstractTaxeditorOperationTest
{
26 private static Taxon relatedTaxon
;
28 private static TaxonRelationshipType oldRelationshipType
;
30 private static TaxonRelationshipType newRelationshipType
;
32 private static TaxonRelationship
[] a
= new TaxonRelationship
[0];
35 public static void setUpBeforeClass() throws Exception
{
36 taxon
= Taxon
.NewInstance(null, null);
37 relatedTaxon
= Taxon
.NewInstance(null, null);
38 oldRelationshipType
= TaxonRelationshipType
.OVERLAPS();
39 newRelationshipType
= TaxonRelationshipType
.OVERLAPS_OR_EXCLUDES();
41 taxon
.addTaxonRelation(relatedTaxon
, oldRelationshipType
, null, null);
42 //oldTaxonRelationship = taxon.getTaxonRelations().toArray(a)[0];
44 operation
= new ChangeConceptRelationshipTypeOperation("Change Concept Relation", null, taxon
, relatedTaxon
, newRelationshipType
, postOperation
);
48 @Ignore // Operation not fully implemented
49 public void testExecute() throws ExecutionException
{
50 operation
.execute(monitor
, info
);
52 Assert
.assertEquals(relatedTaxon
, taxon
.getRelationsFromThisTaxon().toArray(a
)[0].getFromTaxon());
53 Assert
.assertEquals(newRelationshipType
, taxon
.getRelationsFromThisTaxon().toArray(a
)[0].getType());
57 @Ignore // Operation not fully implemented
58 public void testUndo() throws ExecutionException
{
59 operation
.undo(monitor
, info
);
61 Assert
.assertEquals(relatedTaxon
, taxon
.getRelationsFromThisTaxon().toArray(a
)[0].getFromTaxon());
62 Assert
.assertEquals(oldRelationshipType
, taxon
.getRelationsFromThisTaxon().toArray(a
)[0].getType());
66 @Ignore // Operation not fully implemented
67 public void testRedo() throws ExecutionException
{
68 operation
.redo(monitor
, info
);
70 Assert
.assertEquals(relatedTaxon
, taxon
.getRelationsFromThisTaxon().toArray(a
)[0].getFromTaxon());
71 Assert
.assertEquals(newRelationshipType
, taxon
.getRelationsFromThisTaxon().toArray(a
)[0].getType());