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.
9 package eu
.etaxonomy
.taxeditor
.editor
.name
.operation
;
11 import org
.apache
.log4j
.Logger
;
12 import org
.eclipse
.core
.commands
.ExecutionException
;
13 import org
.junit
.Assert
;
14 import org
.junit
.BeforeClass
;
15 import org
.junit
.Test
;
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
;
26 public class DeleteConceptRelationOperationTest
extends AbstractTaxeditorOperationTestBase
{
28 private static final Logger logger
= Logger
.getLogger(DeleteConceptRelationOperationTest
.class);
30 private static TaxonRelationshipType relationshipType
;
31 private static Taxon relatedTaxon
;
34 public static void setUpBeforeClass() throws Exception
{
36 taxon
= Taxon
.NewInstance(null, null);
37 relatedTaxon
= Taxon
.NewInstance(null, null);
38 relationshipType
= TaxonRelationshipType
.CONTRADICTION();
40 taxon
.addTaxonRelation(relatedTaxon
, relationshipType
, null, null);
42 Assert
.assertTrue(taxon
.getTaxonRelations().size() > 0);
44 // operation = new DeleteConceptRelationOperation("", undoContext, taxon, relatedTaxon, postOperation);
48 public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException
{
49 operation
.execute(monitor
, info
);
51 Assert
.assertTrue(taxon
.getTaxonRelations().size() == 0);
55 public void testUndoIProgressMonitorIAdaptable() throws ExecutionException
{
56 operation
.undo(monitor
, info
);
58 Assert
.assertTrue(taxon
.getTaxonRelations().size() > 0);
62 public void testRedoIProgressMonitorIAdaptable() throws ExecutionException
{
63 operation
.redo(monitor
, info
);
65 Assert
.assertTrue(taxon
.getTaxonRelations().size() == 0);
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");