Project

General

Profile

Download (2.67 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.store.operations;
12

    
13
import org.apache.log4j.Logger;
14
import org.eclipse.core.commands.ExecutionException;
15
import org.junit.Assert;
16
import org.junit.BeforeClass;
17
import org.junit.Test;
18

    
19
import eu.etaxonomy.cdm.model.taxon.Taxon;
20

    
21
/**
22
 * @author n.hoffmann
23
 * @created 07.04.2009
24
 * @version 1.0
25
 */
26
public class CreateSynonymInNewGroupOperationTest extends AbstractTaxeditorOperationTest {
27
	private static final Logger logger = Logger
28
			.getLogger(CreateSynonymInNewGroupOperationTest.class);
29
	
30
	
31
	private static String newSynonymText;
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
		newSynonymText = "";
41
		
42
		operation = new CreateSynonymInNewGroupOperation("Create Synonyma In New Group",  undoContext, taxon, newSynonymText, postOperation);
43
	}
44

    
45
	/**
46
	 * Test method for {@link eu.etaxonomy.taxeditor.store.operations.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.store.operations.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.store.operations.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
}
(15-15/22)