ref #6190 removing svn property place holder in first line of code - java files
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / test / java / eu / etaxonomy / taxeditor / editor / name / operation / DeleteConceptRelationOperationTest.java
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
10 package eu.etaxonomy.taxeditor.editor.name.operation;
11
12 import org.apache.log4j.Logger;
13 import org.eclipse.core.commands.ExecutionException;
14 import org.junit.Assert;
15 import org.junit.BeforeClass;
16 import org.junit.Test;
17
18 import eu.etaxonomy.cdm.model.common.ICdmBase;
19 import eu.etaxonomy.cdm.model.taxon.Taxon;
20 import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
21 import eu.etaxonomy.taxeditor.store.operations.AbstractTaxeditorOperationTestBase;
22
23 /**
24 * @author n.hoffmann
25 * @created 08.04.2009
26 * @version 1.0
27 */
28 public class DeleteConceptRelationOperationTest extends AbstractTaxeditorOperationTestBase{
29 private static final Logger logger = Logger
30 .getLogger(DeleteConceptRelationOperationTest.class);
31
32 private static TaxonRelationshipType relationshipType;
33
34 private static Taxon relatedTaxon;
35
36 /**
37 * @throws java.lang.Exception
38 */
39 @BeforeClass
40 public static void setUpBeforeClass() throws Exception {
41
42 taxon = Taxon.NewInstance(null, null);
43 relatedTaxon = Taxon.NewInstance(null, null);
44 relationshipType = TaxonRelationshipType.CONTRADICTION();
45
46 taxon.addTaxonRelation(relatedTaxon, relationshipType, null, null);
47
48 Assert.assertTrue(taxon.getTaxonRelations().size() > 0);
49
50 // operation = new DeleteConceptRelationOperation("", undoContext, taxon, relatedTaxon, postOperation);
51 }
52
53 /**
54 * Test method for {@link eu.etaxonomy.taxeditor.editor.view.concept.operation.DeleteConceptRelationOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
55 * @throws ExecutionException
56 */
57 @Test
58 public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException {
59 operation.execute(monitor, info);
60
61 Assert.assertTrue(taxon.getTaxonRelations().size() == 0);
62 }
63
64 /**
65 * Test method for {@link eu.etaxonomy.taxeditor.editor.view.concept.operation.DeleteConceptRelationOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
66 * @throws ExecutionException
67 */
68 @Test
69 public void testUndoIProgressMonitorIAdaptable() throws ExecutionException {
70 operation.undo(monitor, info);
71
72 Assert.assertTrue(taxon.getTaxonRelations().size() > 0);
73 }
74
75 /**
76 * Test method for {@link eu.etaxonomy.taxeditor.editor.view.concept.operation.DeleteConceptRelationOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
77 * @throws ExecutionException
78 */
79 @Test
80 public void testRedoIProgressMonitorIAdaptable() throws ExecutionException {
81 operation.redo(monitor, info);
82
83 Assert.assertTrue(taxon.getTaxonRelations().size() == 0);
84 }
85
86 /**
87 * Test method for {@link eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation#postExecute(ICdmBase)}.
88 */
89 @Test
90 public void testPostExecute() {
91 // TODO there is not post operation functionality for this class
92 // at the moment. Implement test when there is.
93 logger.warn("No post operation functionality for this class");
94 }
95 }