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
.store
.operations
;
13 import static org
.junit
.Assert
.*;
15 import org
.apache
.log4j
.Logger
;
16 import org
.eclipse
.core
.commands
.ExecutionException
;
17 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
18 import org
.eclipse
.core
.runtime
.IAdaptable
;
19 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
20 import org
.junit
.Assert
;
21 import org
.junit
.BeforeClass
;
22 import org
.junit
.Test
;
24 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
25 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
26 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationshipType
;
33 public class DeleteConceptRelationOperationTest
extends AbstractTaxeditorOperationTest
{
34 private static final Logger logger
= Logger
35 .getLogger(DeleteConceptRelationOperationTest
.class);
37 private static TaxonRelationshipType relationshipType
;
39 private static Taxon relatedTaxon
;
42 * @throws java.lang.Exception
45 public static void setUpBeforeClass() throws Exception
{
47 taxon
= Taxon
.NewInstance(null, null);
48 relatedTaxon
= Taxon
.NewInstance(null, null);
49 relationshipType
= TaxonRelationshipType
.CONTRADICTION();
51 taxon
.addTaxonRelation(relatedTaxon
, relationshipType
, null, null);
53 Assert
.assertTrue(taxon
.getTaxonRelations().size() > 0);
55 operation
= new DeleteConceptRelationOperation("", undoContext
, taxon
, relatedTaxon
, postOperation
);
59 * Test method for {@link eu.etaxonomy.taxeditor.store.operations.DeleteConceptRelationOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
60 * @throws ExecutionException
63 public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException
{
64 operation
.execute(monitor
, info
);
66 Assert
.assertTrue(taxon
.getTaxonRelations().size() == 0);
70 * Test method for {@link eu.etaxonomy.taxeditor.store.operations.DeleteConceptRelationOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
71 * @throws ExecutionException
74 public void testUndoIProgressMonitorIAdaptable() throws ExecutionException
{
75 operation
.undo(monitor
, info
);
77 Assert
.assertTrue(taxon
.getTaxonRelations().size() > 0);
81 * Test method for {@link eu.etaxonomy.taxeditor.store.operations.DeleteConceptRelationOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
82 * @throws ExecutionException
85 public void testRedoIProgressMonitorIAdaptable() throws ExecutionException
{
86 operation
.redo(monitor
, info
);
88 Assert
.assertTrue(taxon
.getTaxonRelations().size() == 0);
92 * Test method for {@link eu.etaxonomy.taxeditor.store.operations.AbstractPostOperation#postExecute(CdmBase)}.
95 public void testPostExecute() {
96 // TODO there is not post operation functionality for this class
97 // at the moment. Implement test when there is.
98 logger
.warn("No post operation functionality for this class");