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
.logging
.log4j
.LogManager
;import org
.apache
.logging
.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
.taxeditor
.store
.operations
.AbstractTaxeditorOperationTestBase
;
25 public class DeleteMisapplicationOperationTest
extends AbstractTaxeditorOperationTestBase
{
27 private static final Logger logger
= LogManager
.getLogger(DeleteMisapplicationOperationTest
.class);
29 private static Taxon taxon
;
30 private static Taxon misapplication
;
33 public static void setUpBeforeClass() throws Exception
{
35 taxon
= Taxon
.NewInstance(null, null);
36 misapplication
= Taxon
.NewInstance(null, null);
38 taxon
.addMisappliedName(misapplication
, null, null);
40 operation
= new DeleteMisapplicationOperation("", undoContext
, null, taxon
, misapplication
, postOperation
, null, null);
45 public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException
{
46 operation
.execute(monitor
, info
);
48 Assert
.assertTrue(taxon
.getMisappliedNames(false).size() == 0);
52 public void testUndoIProgressMonitorIAdaptable() throws ExecutionException
{
53 operation
.undo(monitor
, info
);
55 Assert
.assertEquals(misapplication
, taxon
.getMisappliedNames(false).toArray(new Taxon
[0])[0]);
59 public void testRedoIProgressMonitorIAdaptable() throws ExecutionException
{
60 operation
.redo(monitor
, info
);
62 Assert
.assertTrue(taxon
.getMisappliedNames(false).size() == 0);
66 public void testPostExecute() {
67 // TODO there is not post operation functionality for this class
68 // at the moment. Implement test when there is.
69 logger
.warn("No post operation functionality for this class");