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.
9 package eu
.etaxonomy
.taxeditor
.editor
.name
.operation
;
11 import org
.eclipse
.core
.commands
.ExecutionException
;
12 import org
.junit
.Assert
;
13 import org
.junit
.BeforeClass
;
14 import org
.junit
.Test
;
16 import eu
.etaxonomy
.cdm
.model
.name
.TaxonName
;
17 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameFactory
;
18 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
19 import eu
.etaxonomy
.taxeditor
.editor
.name
.operation
.CreateSynonymInNewGroupOperation
;
20 import eu
.etaxonomy
.taxeditor
.store
.operations
.AbstractTaxeditorOperationTestBase
;
26 public class CreateSynonymInNewGroupOperationTest
extends AbstractTaxeditorOperationTestBase
{
28 private static TaxonName newSynonymName
;
31 public static void setUpBeforeClass() throws Exception
{
33 taxon
= Taxon
.NewInstance(null, null);
34 newSynonymName
= TaxonNameFactory
.NewNonViralInstance(null);
36 operation
= new CreateSynonymInNewGroupOperation("Create Synonyma In New Group", undoContext
, taxon
, newSynonymName
, postOperation
);
40 public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException
{
41 operation
.execute(monitor
, info
);
43 Assert
.assertTrue("Taxon should have synonyms now.", taxon
.getSynonyms().size() > 0);
44 Assert
.assertTrue("Taxon should have a homotypical group now.", taxon
.getHomotypicSynonymyGroups().size() > 0);
48 public void testUndoIProgressMonitorIAdaptable() throws ExecutionException
{
49 operation
.undo(monitor
, info
);
51 Assert
.assertTrue("Taxon should not have synonyms now.", taxon
.getSynonyms().size() == 0);
55 public void testRedoIProgressMonitorIAdaptable() throws ExecutionException
{
56 operation
.redo(monitor
, info
);
58 Assert
.assertTrue("Taxon should have synonyms now.", taxon
.getSynonyms().size() > 0);
59 Assert
.assertTrue("Taxon should have a homotypical group now.", taxon
.getHomotypicSynonymyGroups().size() > 0);