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
.taxeditor
.editor
.name
.operation
.DeleteMisapplicationOperation
;
22 import eu
.etaxonomy
.taxeditor
.store
.operations
.AbstractTaxeditorOperationTest
;
29 public class DeleteMisapplicationOperationTest
extends AbstractTaxeditorOperationTest
{
30 private static final Logger logger
= Logger
31 .getLogger(DeleteMisapplicationOperationTest
.class);
33 private static Taxon taxon
;
35 private static Taxon misapplication
;
38 * @throws java.lang.Exception
41 public static void setUpBeforeClass() throws Exception
{
43 taxon
= Taxon
.NewInstance(null, null);
44 misapplication
= Taxon
.NewInstance(null, null);
46 taxon
.addMisappliedName(misapplication
, null, null);
48 operation
= new DeleteMisapplicationOperation("", undoContext
, taxon
, misapplication
, postOperation
);
52 * Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
53 * @throws ExecutionException
56 public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException
{
57 operation
.execute(monitor
, info
);
59 Assert
.assertTrue(taxon
.getMisappliedNames().size() == 0);
63 * Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
64 * @throws ExecutionException
67 public void testUndoIProgressMonitorIAdaptable() throws ExecutionException
{
68 operation
.undo(monitor
, info
);
70 Assert
.assertEquals(misapplication
, taxon
.getMisappliedNames().toArray(new Taxon
[0])[0]);
74 * Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
75 * @throws ExecutionException
78 public void testRedoIProgressMonitorIAdaptable() throws ExecutionException
{
79 operation
.redo(monitor
, info
);
81 Assert
.assertTrue(taxon
.getMisappliedNames().size() == 0);
85 * Test method for {@link eu.etaxonomy.taxeditor.operation.AbstractPostOperation#postExecute(ICdmBase)}.
88 public void testPostExecute() {
89 // TODO there is not post operation functionality for this class
90 // at the moment. Implement test when there is.
91 logger
.warn("No post operation functionality for this class");