Revision a6de10b5
Added by Katja Luther over 7 years ago
eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteSynonymOperationTest.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2007 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
... | ... | |
16 | 16 |
import org.junit.BeforeClass; |
17 | 17 |
import org.junit.Test; |
18 | 18 |
|
19 |
import eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator; |
|
19 | 20 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
20 | 21 |
import eu.etaxonomy.cdm.model.taxon.SynonymType; |
21 | 22 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
... | ... | |
33 | 34 |
private static Synonym synonym; |
34 | 35 |
|
35 | 36 |
private static SynonymType synonymType; |
36 |
|
|
37 |
|
|
37 | 38 |
/** |
38 | 39 |
* @throws java.lang.Exception |
39 | 40 |
*/ |
... | ... | |
42 | 43 |
taxon = Taxon.NewInstance(null, null); |
43 | 44 |
synonym = Synonym.NewInstance(null, null); |
44 | 45 |
synonymType = SynonymType.SYNONYM_OF(); |
45 |
|
|
46 |
|
|
46 | 47 |
taxon.addSynonym(synonym, synonymType); |
47 |
|
|
48 |
operation = new DeleteSynonymOperation("", undoContext, taxon, synonym, postOperation); |
|
48 |
|
|
49 |
operation = new DeleteSynonymOperation("", undoContext, new SynonymDeletionConfigurator(), null, taxon,synonym, postOperation, null, null); |
|
50 |
|
|
49 | 51 |
} |
50 | 52 |
|
51 | 53 |
/** |
52 | 54 |
* Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.DeleteSynonymOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}. |
53 |
* @throws ExecutionException
|
|
55 |
* @throws ExecutionException |
|
54 | 56 |
*/ |
55 | 57 |
@Test |
56 | 58 |
public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException { |
57 | 59 |
operation.execute(monitor, info); |
58 |
|
|
60 |
|
|
59 | 61 |
Assert.assertTrue(taxon.getSynonyms().size() == 0); |
60 | 62 |
} |
61 | 63 |
|
62 | 64 |
/** |
63 | 65 |
* Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.DeleteSynonymOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}. |
64 |
* @throws ExecutionException
|
|
66 |
* @throws ExecutionException |
|
65 | 67 |
*/ |
66 | 68 |
@Test |
67 | 69 |
public void testUndoIProgressMonitorIAdaptable() throws ExecutionException { |
68 | 70 |
operation.undo(monitor, info); |
69 |
|
|
71 |
|
|
70 | 72 |
Assert.assertTrue(taxon.getSynonyms().size() > 0); |
71 | 73 |
Assert.assertEquals(synonym, taxon.getSynonyms().toArray(new Synonym[0])[0]); |
72 | 74 |
} |
73 | 75 |
|
74 | 76 |
/** |
75 | 77 |
* Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.DeleteSynonymOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}. |
76 |
* @throws ExecutionException
|
|
78 |
* @throws ExecutionException |
|
77 | 79 |
*/ |
78 | 80 |
@Test |
79 | 81 |
public void testRedoIProgressMonitorIAdaptable() throws ExecutionException { |
80 | 82 |
operation.redo(monitor, info); |
81 |
|
|
83 |
|
|
82 | 84 |
Assert.assertTrue(taxon.getSynonyms().size() == 0); |
83 | 85 |
} |
84 | 86 |
} |
Also available in: Unified diff
ref #6219: add warning that synonym is deleted immediately