3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.taxeditor
.editor
.name
.operation
;
13 import org
.apache
.log4j
.Logger
;
14 import org
.eclipse
.core
.commands
.ExecutionException
;
15 import org
.junit
.Assert
;
16 import org
.junit
.BeforeClass
;
17 import org
.junit
.Test
;
19 import eu
.etaxonomy
.cdm
.model
.common
.ICdmBase
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
21 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationshipType
;
22 import eu
.etaxonomy
.taxeditor
.store
.operations
.AbstractTaxeditorOperationTestBase
;
29 public class DeleteConceptRelationOperationTest
extends AbstractTaxeditorOperationTestBase
{
30 private static final Logger logger
= Logger
31 .getLogger(DeleteConceptRelationOperationTest
.class);
33 private static TaxonRelationshipType relationshipType
;
35 private static Taxon relatedTaxon
;
38 * @throws java.lang.Exception
41 public static void setUpBeforeClass() throws Exception
{
43 taxon
= Taxon
.NewInstance(null, null);
44 relatedTaxon
= Taxon
.NewInstance(null, null);
45 relationshipType
= TaxonRelationshipType
.CONTRADICTION();
47 taxon
.addTaxonRelation(relatedTaxon
, relationshipType
, null, null);
49 Assert
.assertTrue(taxon
.getTaxonRelations().size() > 0);
51 // operation = new DeleteConceptRelationOperation("", undoContext, taxon, relatedTaxon, postOperation);
55 * Test method for {@link eu.etaxonomy.taxeditor.editor.view.concept.operation.DeleteConceptRelationOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
56 * @throws ExecutionException
59 public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException
{
60 operation
.execute(monitor
, info
);
62 Assert
.assertTrue(taxon
.getTaxonRelations().size() == 0);
66 * Test method for {@link eu.etaxonomy.taxeditor.editor.view.concept.operation.DeleteConceptRelationOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
67 * @throws ExecutionException
70 public void testUndoIProgressMonitorIAdaptable() throws ExecutionException
{
71 operation
.undo(monitor
, info
);
73 Assert
.assertTrue(taxon
.getTaxonRelations().size() > 0);
77 * Test method for {@link eu.etaxonomy.taxeditor.editor.view.concept.operation.DeleteConceptRelationOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
78 * @throws ExecutionException
81 public void testRedoIProgressMonitorIAdaptable() throws ExecutionException
{
82 operation
.redo(monitor
, info
);
84 Assert
.assertTrue(taxon
.getTaxonRelations().size() == 0);
88 * Test method for {@link eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation#postExecute(ICdmBase)}.
91 public void testPostExecute() {
92 // TODO there is not post operation functionality for this class
93 // at the moment. Implement test when there is.
94 logger
.warn("No post operation functionality for this class");