3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.taxeditor
.store
.operations
;
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
;
19 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
21 import eu
.etaxonomy
.taxeditor
.operations
.DeleteTaxonNodeOperation
;
28 public class DeleteTaxonNodeOperationTest
extends AbstractTaxeditorOperationTest
{
29 private static final Logger logger
= Logger
30 .getLogger(DeleteTaxonNodeOperationTest
.class);
32 private static Taxon child
;
34 private static TaxonNode taxonNode
;
37 * @throws java.lang.Exception
40 public static void setUpBeforeClass() throws Exception
{
41 // TODO get taxon from integration test data
42 taxon
= Taxon
.NewInstance(null, null);
44 child
= Taxon
.NewInstance(null, null);
46 taxon
.addTaxonomicChild(child
, null, null);
48 operation
= new DeleteTaxonNodeOperation("Delete Taxon", undoContext
, taxonNode
, null, null);
52 * Test method for {@link eu.etaxonomy.taxeditor.operations.DeleteTaxonNodeOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
53 * @throws ExecutionException
56 public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException
{
58 operation
.execute(monitor
, info
);
60 Assert
.assertTrue(taxon
.getTaxonomicChildren().size() == 0);
61 Assert
.assertTrue(taxon
.getTaxonomicChildrenCount() == 0);
65 * Test method for {@link eu.etaxonomy.taxeditor.operations.DeleteTaxonNodeOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
66 * @throws ExecutionException
69 public void testUndoIProgressMonitorIAdaptable() throws ExecutionException
{
71 operation
.execute(monitor
, info
);
73 Assert
.assertTrue(taxon
.getTaxonomicChildren().size() > 0);
74 Assert
.assertTrue(taxon
.getTaxonomicChildrenCount() > 0);
78 * Test method for {@link eu.etaxonomy.taxeditor.operations.DeleteTaxonNodeOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
79 * @throws ExecutionException
82 public void testRedoIProgressMonitorIAdaptable() throws ExecutionException
{
84 operation
.execute(monitor
, info
);
86 Assert
.assertTrue(taxon
.getTaxonomicChildren().size() == 0);
87 Assert
.assertTrue(taxon
.getTaxonomicChildrenCount() == 0);