Moving editor sources back into trunk
[taxeditor.git] / taxeditor-store / src / test / java / eu / etaxonomy / taxeditor / store / operations / CreateMisapplicationOperationTest.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
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.
9 */
10
11 package eu.etaxonomy.taxeditor.store.operations;
12
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;
18
19 import eu.etaxonomy.cdm.model.taxon.Taxon;
20
21 /**
22 * @author n.hoffmann
23 * @created 07.04.2009
24 * @version 1.0
25 */
26 public class CreateMisapplicationOperationTest extends AbstractTaxeditorOperationTest {
27 private static final Logger logger = Logger
28 .getLogger(CreateMisapplicationOperationTest.class);
29
30 private static Taxon taxon;
31
32 /**
33 * @throws java.lang.Exception
34 */
35 @BeforeClass
36 public static void setUpBeforeClass() throws Exception {
37
38 taxon = Taxon.NewInstance(null, null);
39
40 operation = new CreateMisapplicationOperation("Create Misapplication", undoContext, taxon, postOperation);
41 }
42
43 /**
44 * Test method for {@link eu.etaxonomy.taxeditor.store.operations.CreateMisapplicationOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
45 * @throws ExecutionException
46 */
47 @Test
48 public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException {
49 operation.execute(monitor, info);
50
51 Assert.assertTrue("Taxon should have misapplications now.", taxon.getMisappliedNames().size() > 0);
52 }
53
54 /**
55 * Test method for {@link eu.etaxonomy.taxeditor.store.operations.CreateMisapplicationOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
56 * @throws ExecutionException
57 */
58 @Test
59 public void testUndoIProgressMonitorIAdaptable() throws ExecutionException {
60 operation.undo(monitor, info);
61
62 Assert.assertTrue("Taxon should not have misapplications now.", taxon.getMisappliedNames().size() == 0);
63 }
64
65 /**
66 * Test method for {@link eu.etaxonomy.taxeditor.store.operations.CreateMisapplicationOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
67 * @throws ExecutionException
68 */
69 @Test
70 public void testRedoIProgressMonitorIAdaptable() throws ExecutionException {
71 operation.redo(monitor, info);
72
73 Assert.assertTrue("Taxon should have misapplications now.", taxon.getMisappliedNames().size() > 0);
74 }
75 }