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
;
27 public class DeleteMisapplicationOperationTest
extends AbstractTaxeditorOperationTest
{
28 private static final Logger logger
= Logger
29 .getLogger(DeleteMisapplicationOperationTest
.class);
31 private static Taxon taxon
;
33 private static Taxon misapplication
;
36 * @throws java.lang.Exception
39 public static void setUpBeforeClass() throws Exception
{
41 taxon
= Taxon
.NewInstance(null, null);
42 misapplication
= Taxon
.NewInstance(null, null);
44 taxon
.addMisappliedName(misapplication
, null, null);
46 operation
= new DeleteMisapplicationOperation("", undoContext
, taxon
, misapplication
, postOperation
);
50 * Test method for {@link eu.etaxonomy.taxeditor.store.operations.DeleteMisapplicationOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
51 * @throws ExecutionException
54 public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException
{
55 operation
.execute(monitor
, info
);
57 Assert
.assertTrue(taxon
.getMisappliedNames().size() == 0);
61 * Test method for {@link eu.etaxonomy.taxeditor.store.operations.DeleteMisapplicationOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
62 * @throws ExecutionException
65 public void testUndoIProgressMonitorIAdaptable() throws ExecutionException
{
66 operation
.undo(monitor
, info
);
68 Assert
.assertEquals(misapplication
, taxon
.getMisappliedNames().toArray(new Taxon
[0])[0]);
72 * Test method for {@link eu.etaxonomy.taxeditor.store.operations.DeleteMisapplicationOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
73 * @throws ExecutionException
76 public void testRedoIProgressMonitorIAdaptable() throws ExecutionException
{
77 operation
.redo(monitor
, info
);
79 Assert
.assertTrue(taxon
.getMisappliedNames().size() == 0);
83 * Test method for {@link eu.etaxonomy.taxeditor.store.operations.AbstractPostOperation#postExecute(CdmBase)}.
86 public void testPostExecute() {
87 // TODO there is not post operation functionality for this class
88 // at the moment. Implement test when there is.
89 logger
.warn("No post operation functionality for this class");