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 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
.CdmBase
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
21 import eu
.etaxonomy
.taxeditor
.operations
.DeleteMisapplicationOperation
;
28 public class DeleteMisapplicationOperationTest
extends AbstractTaxeditorOperationTest
{
29 private static final Logger logger
= Logger
30 .getLogger(DeleteMisapplicationOperationTest
.class);
32 private static Taxon taxon
;
34 private static Taxon misapplication
;
37 * @throws java.lang.Exception
40 public static void setUpBeforeClass() throws Exception
{
42 taxon
= Taxon
.NewInstance(null, null);
43 misapplication
= Taxon
.NewInstance(null, null);
45 taxon
.addMisappliedName(misapplication
, null, null);
47 operation
= new DeleteMisapplicationOperation("", undoContext
, taxon
, misapplication
, postOperation
);
51 * Test method for {@link eu.etaxonomy.taxeditor.operations.DeleteMisapplicationOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
52 * @throws ExecutionException
55 public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException
{
56 operation
.execute(monitor
, info
);
58 Assert
.assertTrue(taxon
.getMisappliedNames().size() == 0);
62 * Test method for {@link eu.etaxonomy.taxeditor.operations.DeleteMisapplicationOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
63 * @throws ExecutionException
66 public void testUndoIProgressMonitorIAdaptable() throws ExecutionException
{
67 operation
.undo(monitor
, info
);
69 Assert
.assertEquals(misapplication
, taxon
.getMisappliedNames().toArray(new Taxon
[0])[0]);
73 * Test method for {@link eu.etaxonomy.taxeditor.operations.DeleteMisapplicationOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
74 * @throws ExecutionException
77 public void testRedoIProgressMonitorIAdaptable() throws ExecutionException
{
78 operation
.redo(monitor
, info
);
80 Assert
.assertTrue(taxon
.getMisappliedNames().size() == 0);
84 * Test method for {@link eu.etaxonomy.taxeditor.operations.AbstractPostOperation#postExecute(CdmBase)}.
87 public void testPostExecute() {
88 // TODO there is not post operation functionality for this class
89 // at the moment. Implement test when there is.
90 logger
.warn("No post operation functionality for this class");