Project

General

Profile

Download (2.31 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
4
* http://www.e-taxonomy.eu
5
* 
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.editor.name.operation;
10

    
11
import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
12
import org.eclipse.core.commands.ExecutionException;
13
import org.junit.Assert;
14
import org.junit.BeforeClass;
15
import org.junit.Test;
16

    
17
import eu.etaxonomy.cdm.model.common.ICdmBase;
18
import eu.etaxonomy.cdm.model.taxon.Taxon;
19
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
20
import eu.etaxonomy.taxeditor.store.operations.AbstractTaxeditorOperationTestBase;
21

    
22
/**
23
 * @author n.hoffmann
24
 * @created 08.04.2009
25
 */
26
public class DeleteConceptRelationOperationTest extends AbstractTaxeditorOperationTestBase{
27
	
28
	private static final Logger logger = LogManager.getLogger(DeleteConceptRelationOperationTest.class);
29

    
30
	private static TaxonRelationshipType relationshipType;
31
	private static Taxon relatedTaxon;
32

    
33
	@BeforeClass
34
	public static void setUpBeforeClass() throws Exception {
35
		
36
		taxon = Taxon.NewInstance(null, null);
37
		relatedTaxon = Taxon.NewInstance(null, null);
38
		relationshipType = TaxonRelationshipType.CONTRADICTION();
39
		
40
		taxon.addTaxonRelation(relatedTaxon, relationshipType, null, null);
41
		
42
		Assert.assertTrue(taxon.getTaxonRelations().size() > 0);
43
		
44
//		operation = new DeleteConceptRelationOperation("", undoContext, taxon, relatedTaxon, postOperation);
45
	}
46

    
47
	@Test
48
	public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException {
49
		operation.execute(monitor, info);
50
		
51
		Assert.assertTrue(taxon.getTaxonRelations().size() == 0);
52
	}
53

    
54
	@Test
55
	public void testUndoIProgressMonitorIAdaptable() throws ExecutionException {
56
		operation.undo(monitor, info);
57
		
58
		Assert.assertTrue(taxon.getTaxonRelations().size() > 0);
59
	}
60

    
61
	@Test
62
	public void testRedoIProgressMonitorIAdaptable() throws ExecutionException {
63
		operation.redo(monitor, info);
64
		
65
		Assert.assertTrue(taxon.getTaxonRelations().size() == 0);
66
	}
67

    
68
	@Test
69
	public void testPostExecute() {
70
		// TODO there is not post operation functionality for this class
71
		// at the moment. Implement test when there is.
72
		logger.warn("No post operation functionality for this class");
73
	}
74
}
(12-12/16)