Revision d175d20f
Added by Cherian Mathew almost 9 years ago
eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteDescriptionElementOperationTest.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 |
*/ |
... | ... | |
32 | 32 |
private static DescriptionElementBase descriptionElement; |
33 | 33 |
|
34 | 34 |
private static TaxonDescription description; |
35 |
|
|
35 |
|
|
36 | 36 |
/** |
37 | 37 |
* @throws java.lang.Exception |
38 | 38 |
*/ |
... | ... | |
40 | 40 |
public static void setUpBeforeClass() throws Exception { |
41 | 41 |
taxon = Taxon.NewInstance(null, null); |
42 | 42 |
descriptionElement = TextData.NewInstance(); |
43 |
|
|
43 |
|
|
44 | 44 |
description = TaxonDescription.NewInstance(); |
45 |
|
|
45 |
|
|
46 | 46 |
description.addElement(descriptionElement); |
47 |
|
|
47 |
|
|
48 | 48 |
taxon.addDescription(description); |
49 |
|
|
50 |
|
|
51 |
operation = new DeleteDescriptionElementOperation("", undoContext, descriptionElement, postOperation); |
|
49 |
|
|
50 |
|
|
51 |
operation = new DeleteDescriptionElementOperation("", undoContext, descriptionElement, postOperation, cdmEntitySessionEnabled);
|
|
52 | 52 |
} |
53 | 53 |
|
54 | 54 |
/** |
55 | 55 |
* Test method for {@link eu.etaxonomy.taxeditor.editor.view.descriptive.operation.DeleteDescriptionElementOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}. |
56 |
* @throws ExecutionException
|
|
56 |
* @throws ExecutionException |
|
57 | 57 |
*/ |
58 | 58 |
@Test |
59 | 59 |
public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException { |
60 | 60 |
operation.execute(monitor, info); |
61 |
|
|
61 |
|
|
62 | 62 |
Assert.assertTrue(taxon.getDescriptions().toArray(new TaxonDescription[0])[0].getElements().size() == 0); |
63 | 63 |
} |
64 | 64 |
|
65 | 65 |
/** |
66 | 66 |
* Test method for {@link eu.etaxonomy.taxeditor.editor.view.descriptive.operation.DeleteDescriptionElementOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}. |
67 |
* @throws ExecutionException
|
|
67 |
* @throws ExecutionException |
|
68 | 68 |
*/ |
69 | 69 |
@Test |
70 | 70 |
public void testUndoIProgressMonitorIAdaptable() throws ExecutionException { |
71 | 71 |
operation.undo(monitor, info); |
72 |
|
|
72 |
|
|
73 | 73 |
Assert.assertTrue(taxon.getDescriptions().toArray(new TaxonDescription[0])[0].getElements().size() > 0); |
74 | 74 |
Assert.assertEquals(descriptionElement, taxon.getDescriptions().toArray(new TaxonDescription[0])[0].getElements().toArray(new DescriptionElementBase[0])[0]); |
75 | 75 |
} |
76 | 76 |
|
77 | 77 |
/** |
78 | 78 |
* Test method for {@link eu.etaxonomy.taxeditor.editor.view.descriptive.operation.DeleteDescriptionElementOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}. |
79 |
* @throws ExecutionException
|
|
79 |
* @throws ExecutionException |
|
80 | 80 |
*/ |
81 | 81 |
@Test |
82 | 82 |
public void testRedoIProgressMonitorIAdaptable() throws ExecutionException { |
83 | 83 |
operation.redo(monitor, info); |
84 |
|
|
84 |
|
|
85 | 85 |
Assert.assertTrue(taxon.getDescriptions().toArray(new TaxonDescription[0])[0].getElements().size() == 0); |
86 | 86 |
} |
87 | 87 |
} |
Also available in: Unified diff
added cdm entitysession enabled objects to operations