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
.name
.NonViralName
;
19 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
21 import eu
.etaxonomy
.taxeditor
.operations
.CreateSynonymInNewGroupOperation
;
28 public class CreateSynonymInNewGroupOperationTest
extends AbstractTaxeditorOperationTest
{
30 private static TaxonNameBase newSynonymName
;
33 * @throws java.lang.Exception
36 public static void setUpBeforeClass() throws Exception
{
38 taxon
= Taxon
.NewInstance(null, null);
39 newSynonymName
= NonViralName
.NewInstance(null);
41 operation
= new CreateSynonymInNewGroupOperation("Create Synonyma In New Group", undoContext
, taxon
, newSynonymName
, postOperation
);
45 * Test method for {@link eu.etaxonomy.taxeditor.operations.CreateSynonymInNewGroupOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
46 * @throws ExecutionException
49 public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException
{
50 operation
.execute(monitor
, info
);
52 Assert
.assertTrue("Taxon should have synonyms now.", taxon
.getSynonyms().size() > 0);
53 Assert
.assertTrue("Taxon should have a homotypical group now.", taxon
.getHomotypicSynonymyGroups().size() > 0);
57 * Test method for {@link eu.etaxonomy.taxeditor.operations.CreateSynonymInNewGroupOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
58 * @throws ExecutionException
61 public void testUndoIProgressMonitorIAdaptable() throws ExecutionException
{
62 operation
.undo(monitor
, info
);
64 Assert
.assertTrue("Taxon should not have synonyms now.", taxon
.getSynonyms().size() == 0);
68 * Test method for {@link eu.etaxonomy.taxeditor.operations.CreateSynonymInNewGroupOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
69 * @throws ExecutionException
72 public void testRedoIProgressMonitorIAdaptable() throws ExecutionException
{
73 operation
.redo(monitor
, info
);
75 Assert
.assertTrue("Taxon should have synonyms now.", taxon
.getSynonyms().size() > 0);
76 Assert
.assertTrue("Taxon should have a homotypical group now.", taxon
.getHomotypicSynonymyGroups().size() > 0);