Project

General

Profile

Download (2.86 KB) Statistics
| Branch: | Tag: | Revision:
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.editor.name.operation;
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.name.NonViralName;
19
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
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;
23

    
24
/**
25
 * @author n.hoffmann
26
 * @created 07.04.2009
27
 * @version 1.0
28
 */
29
public class CreateSynonymInNewGroupOperationTest extends AbstractTaxeditorOperationTestBase {	
30
	
31
	private static TaxonNameBase newSynonymName;
32
	
33
	/**
34
	 * @throws java.lang.Exception
35
	 */
36
	@BeforeClass
37
	public static void setUpBeforeClass() throws Exception {
38
		
39
		taxon = Taxon.NewInstance(null, null);
40
		newSynonymName = NonViralName.NewInstance(null);
41
		
42
		operation = new CreateSynonymInNewGroupOperation("Create Synonyma In New Group",  undoContext, taxon, newSynonymName, postOperation);
43
	}
44

    
45
	/**
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 
48
	 */
49
	@Test
50
	public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException {
51
		operation.execute(monitor, info);
52
		
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);
55
	}
56

    
57
	/**
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 
60
	 */
61
	@Test
62
	public void testUndoIProgressMonitorIAdaptable() throws ExecutionException {
63
		operation.undo(monitor, info);
64
		
65
		Assert.assertTrue("Taxon should not have synonyms now.", taxon.getSynonyms().size() == 0);
66
	}
67

    
68
	/**
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 
71
	 */
72
	@Test
73
	public void testRedoIProgressMonitorIAdaptable() throws ExecutionException {
74
		operation.redo(monitor, info);
75
		
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);
78

    
79
	}
80
}
(11-11/17)