Project

General

Profile

Download (2.6 KB) Statistics
| Branch: | Tag: | Revision:
1

    
2
package eu.etaxonomy.taxeditor.editor.name.operation;
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.editor.name.operation.ChangeConceptRelationshipTypeOperation;
15
import eu.etaxonomy.taxeditor.store.operations.AbstractTaxeditorOperationTestBase;
16

    
17
/**
18
 * Specification for changing the concept relation between two taxa
19
 * 
20
 * @author n.hoffmann
21
 * @created 07.04.2009
22
 * @version 1.0
23
 */
24
public class ChangeConceptRelationshipTypeOperationTest extends AbstractTaxeditorOperationTestBase {
25
	
26
	private static Taxon relatedTaxon;
27

    
28
	private static TaxonRelationshipType oldRelationshipType;
29

    
30
	private static TaxonRelationshipType newRelationshipType;
31
	
32
	private static TaxonRelationship[] a = new TaxonRelationship[0];
33

    
34
	@BeforeClass
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();
40
		
41
		taxon.addTaxonRelation(relatedTaxon, oldRelationshipType, null, null);
42
		//oldTaxonRelationship = taxon.getTaxonRelations().toArray(a)[0];
43
		
44
		operation = new ChangeConceptRelationshipTypeOperation("Change Concept Relation", null, taxon, relatedTaxon, newRelationshipType, postOperation);
45
	}
46

    
47
	@Test
48
	@Ignore // Operation not fully implemented
49
	public void testExecute() throws ExecutionException {
50
		operation.execute(monitor, info);
51
		
52
		Assert.assertEquals(relatedTaxon, taxon.getRelationsFromThisTaxon().toArray(a)[0].getFromTaxon());
53
		Assert.assertEquals(newRelationshipType, taxon.getRelationsFromThisTaxon().toArray(a)[0].getType());
54
	}
55

    
56
	@Test
57
	@Ignore // Operation not fully implemented
58
	public void testUndo() throws ExecutionException {
59
		operation.undo(monitor, info);
60
		
61
		Assert.assertEquals(relatedTaxon, taxon.getRelationsFromThisTaxon().toArray(a)[0].getFromTaxon());
62
		Assert.assertEquals(oldRelationshipType, taxon.getRelationsFromThisTaxon().toArray(a)[0].getType());
63
	}
64
	
65
	@Test
66
	@Ignore // Operation not fully implemented
67
	public void testRedo() throws ExecutionException {
68
		operation.redo(monitor, info);
69
		
70
		Assert.assertEquals(relatedTaxon, taxon.getRelationsFromThisTaxon().toArray(a)[0].getFromTaxon());
71
		Assert.assertEquals(newRelationshipType, taxon.getRelationsFromThisTaxon().toArray(a)[0].getType());
72
	}
73

    
74
}
(1-1/17)