editor now updatable via updateSite
[taxeditor.git] / taxeditor-store / src / test / java / eu / etaxonomy / taxeditor / store / operations / CreateSynonymInNewGroupOperationTest.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
20 /**
21 * @author n.hoffmann
22 * @created 07.04.2009
23 * @version 1.0
24 */
25 public class CreateSynonymInNewGroupOperationTest extends AbstractTaxeditorOperationTest {
26
27 private static String newSynonymText;
28
29 /**
30 * @throws java.lang.Exception
31 */
32 @BeforeClass
33 public static void setUpBeforeClass() throws Exception {
34
35 taxon = Taxon.NewInstance(null, null);
36 newSynonymText = "";
37
38 operation = new CreateSynonymInNewGroupOperation("Create Synonyma In New Group", undoContext, taxon, newSynonymText, postOperation);
39 }
40
41 /**
42 * Test method for {@link eu.etaxonomy.taxeditor.store.operations.CreateSynonymInNewGroupOperation#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 synonyms now.", taxon.getSynonyms().size() > 0);
50 Assert.assertTrue("Taxon should have a homotypical group now.", taxon.getHomotypicSynonymyGroups().size() > 0);
51 }
52
53 /**
54 * Test method for {@link eu.etaxonomy.taxeditor.store.operations.CreateSynonymInNewGroupOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
55 * @throws ExecutionException
56 */
57 @Test
58 public void testUndoIProgressMonitorIAdaptable() throws ExecutionException {
59 operation.undo(monitor, info);
60
61 Assert.assertTrue("Taxon should not have synonyms now.", taxon.getSynonyms().size() == 0);
62 }
63
64 /**
65 * Test method for {@link eu.etaxonomy.taxeditor.store.operations.CreateSynonymInNewGroupOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
66 * @throws ExecutionException
67 */
68 @Test
69 public void testRedoIProgressMonitorIAdaptable() throws ExecutionException {
70 operation.redo(monitor, info);
71
72 Assert.assertTrue("Taxon should have synonyms now.", taxon.getSynonyms().size() > 0);
73 Assert.assertTrue("Taxon should have a homotypical group now.", taxon.getHomotypicSynonymyGroups().size() > 0);
74
75 }
76 }