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
.eclipse
.core
.commands
.ExecutionException
;
14 import org
.junit
.Assert
;
15 import org
.junit
.BeforeClass
;
16 import org
.junit
.Test
;
18 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
19 import eu
.etaxonomy
.taxeditor
.operations
.CreateMisapplicationOperation
;
26 public class CreateMisapplicationOperationTest
extends AbstractTaxeditorOperationTest
{
28 private static Taxon taxon
;
31 * @throws java.lang.Exception
34 public static void setUpBeforeClass() throws Exception
{
36 taxon
= Taxon
.NewInstance(null, null);
38 operation
= new CreateMisapplicationOperation("Create Misapplication", undoContext
, taxon
, postOperation
);
42 * Test method for {@link eu.etaxonomy.taxeditor.operations.CreateMisapplicationOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
43 * @throws ExecutionException
46 public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException
{
47 operation
.execute(monitor
, info
);
49 Assert
.assertTrue("Taxon should have misapplications now.", taxon
.getMisappliedNames().size() > 0);
53 * Test method for {@link eu.etaxonomy.taxeditor.operations.CreateMisapplicationOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
54 * @throws ExecutionException
57 public void testUndoIProgressMonitorIAdaptable() throws ExecutionException
{
58 operation
.undo(monitor
, info
);
60 Assert
.assertTrue("Taxon should not have misapplications now.", taxon
.getMisappliedNames().size() == 0);
64 * Test method for {@link eu.etaxonomy.taxeditor.operations.CreateMisapplicationOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
65 * @throws ExecutionException
68 public void testRedoIProgressMonitorIAdaptable() throws ExecutionException
{
69 operation
.redo(monitor
, info
);
71 Assert
.assertTrue("Taxon should have misapplications now.", taxon
.getMisappliedNames().size() > 0);