#823
[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.eclipse.core.commands.ExecutionException;
14 import org.junit.Assert;
15 import org.junit.BeforeClass;
16 import org.junit.Test;
17
18 import eu.etaxonomy.cdm.model.taxon.Taxon;
19 import eu.etaxonomy.taxeditor.operations.CreateMisapplicationOperation;
20
21 /**
22 * @author n.hoffmann
23 * @created 07.04.2009
24 * @version 1.0
25 */
26 public class CreateMisapplicationOperationTest extends AbstractTaxeditorOperationTest {
27
28 private static Taxon taxon;
29
30 /**
31 * @throws java.lang.Exception
32 */
33 @BeforeClass
34 public static void setUpBeforeClass() throws Exception {
35
36 taxon = Taxon.NewInstance(null, null);
37
38 operation = new CreateMisapplicationOperation("Create Misapplication", undoContext, taxon, postOperation);
39 }
40
41 /**
42 * Test method for {@link eu.etaxonomy.taxeditor.operations.CreateMisapplicationOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
43 * @throws ExecutionException
44 */
45 @Test
46 public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException {
47 operation.execute(monitor, info);
48
49 Assert.assertTrue("Taxon should have misapplications now.", taxon.getMisappliedNames().size() > 0);
50 }
51
52 /**
53 * Test method for {@link eu.etaxonomy.taxeditor.operations.CreateMisapplicationOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
54 * @throws ExecutionException
55 */
56 @Test
57 public void testUndoIProgressMonitorIAdaptable() throws ExecutionException {
58 operation.undo(monitor, info);
59
60 Assert.assertTrue("Taxon should not have misapplications now.", taxon.getMisappliedNames().size() == 0);
61 }
62
63 /**
64 * Test method for {@link eu.etaxonomy.taxeditor.operations.CreateMisapplicationOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
65 * @throws ExecutionException
66 */
67 @Test
68 public void testRedoIProgressMonitorIAdaptable() throws ExecutionException {
69 operation.redo(monitor, info);
70
71 Assert.assertTrue("Taxon should have misapplications now.", taxon.getMisappliedNames().size() > 0);
72 }
73 }