2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.editor
.name
.operation
;
12 import org
.eclipse
.core
.commands
.ExecutionException
;
13 import org
.junit
.Assert
;
14 import org
.junit
.BeforeClass
;
15 import org
.junit
.Test
;
17 import eu
.etaxonomy
.cdm
.model
.name
.NonViralName
;
18 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
19 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameFactory
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
21 import eu
.etaxonomy
.taxeditor
.editor
.name
.operation
.CreateSynonymInNewGroupOperation
;
22 import eu
.etaxonomy
.taxeditor
.store
.operations
.AbstractTaxeditorOperationTestBase
;
29 public class CreateSynonymInNewGroupOperationTest
extends AbstractTaxeditorOperationTestBase
{
31 private static TaxonNameBase newSynonymName
;
34 * @throws java.lang.Exception
37 public static void setUpBeforeClass() throws Exception
{
39 taxon
= Taxon
.NewInstance(null, null);
40 newSynonymName
= TaxonNameFactory
.NewNonViralInstance(null);
42 operation
= new CreateSynonymInNewGroupOperation("Create Synonyma In New Group", undoContext
, taxon
, newSynonymName
, postOperation
);
46 * Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInNewGroupOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
47 * @throws ExecutionException
50 public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException
{
51 operation
.execute(monitor
, info
);
53 Assert
.assertTrue("Taxon should have synonyms now.", taxon
.getSynonyms().size() > 0);
54 Assert
.assertTrue("Taxon should have a homotypical group now.", taxon
.getHomotypicSynonymyGroups().size() > 0);
58 * Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInNewGroupOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
59 * @throws ExecutionException
62 public void testUndoIProgressMonitorIAdaptable() throws ExecutionException
{
63 operation
.undo(monitor
, info
);
65 Assert
.assertTrue("Taxon should not have synonyms now.", taxon
.getSynonyms().size() == 0);
69 * Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInNewGroupOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
70 * @throws ExecutionException
73 public void testRedoIProgressMonitorIAdaptable() throws ExecutionException
{
74 operation
.redo(monitor
, info
);
76 Assert
.assertTrue("Taxon should have synonyms now.", taxon
.getSynonyms().size() > 0);
77 Assert
.assertTrue("Taxon should have a homotypical group now.", taxon
.getHomotypicSynonymyGroups().size() > 0);