2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.editor
.name
.operation
;
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
;
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
;
28 public class DeleteConceptRelationOperationTest
extends AbstractTaxeditorOperationTestBase
{
29 private static final Logger logger
= Logger
30 .getLogger(DeleteConceptRelationOperationTest
.class);
32 private static TaxonRelationshipType relationshipType
;
34 private static Taxon relatedTaxon
;
37 * @throws java.lang.Exception
40 public static void setUpBeforeClass() throws Exception
{
42 taxon
= Taxon
.NewInstance(null, null);
43 relatedTaxon
= Taxon
.NewInstance(null, null);
44 relationshipType
= TaxonRelationshipType
.CONTRADICTION();
46 taxon
.addTaxonRelation(relatedTaxon
, relationshipType
, null, null);
48 Assert
.assertTrue(taxon
.getTaxonRelations().size() > 0);
50 // operation = new DeleteConceptRelationOperation("", undoContext, taxon, relatedTaxon, postOperation);
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
58 public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException
{
59 operation
.execute(monitor
, info
);
61 Assert
.assertTrue(taxon
.getTaxonRelations().size() == 0);
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
69 public void testUndoIProgressMonitorIAdaptable() throws ExecutionException
{
70 operation
.undo(monitor
, info
);
72 Assert
.assertTrue(taxon
.getTaxonRelations().size() > 0);
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
80 public void testRedoIProgressMonitorIAdaptable() throws ExecutionException
{
81 operation
.redo(monitor
, info
);
83 Assert
.assertTrue(taxon
.getTaxonRelations().size() == 0);
87 * Test method for {@link eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation#postExecute(ICdmBase)}.
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");