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
;
26 public class DeleteTaxonOperationTest
extends AbstractTaxeditorOperationTest
{
27 private static final Logger logger
= Logger
28 .getLogger(DeleteTaxonOperationTest
.class);
30 private static Taxon child
;
33 * @throws java.lang.Exception
36 public static void setUpBeforeClass() throws Exception
{
37 // TODO get taxon from integration test data
38 taxon
= Taxon
.NewInstance(null, null);
40 child
= Taxon
.NewInstance(null, null);
42 taxon
.addTaxonomicChild(child
, null, null);
44 operation
= new DeleteTaxonOperation("Delete Taxon", undoContext
, taxon
);
48 * Test method for {@link eu.etaxonomy.taxeditor.store.operations.DeleteTaxonOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
49 * @throws ExecutionException
52 public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException
{
54 operation
.execute(monitor
, info
);
56 Assert
.assertTrue(taxon
.getTaxonomicChildren().size() == 0);
57 Assert
.assertTrue(taxon
.getTaxonomicChildrenCount() == 0);
61 * Test method for {@link eu.etaxonomy.taxeditor.store.operations.DeleteTaxonOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
62 * @throws ExecutionException
65 public void testUndoIProgressMonitorIAdaptable() throws ExecutionException
{
67 operation
.execute(monitor
, info
);
69 Assert
.assertTrue(taxon
.getTaxonomicChildren().size() > 0);
70 Assert
.assertTrue(taxon
.getTaxonomicChildrenCount() > 0);
74 * Test method for {@link eu.etaxonomy.taxeditor.store.operations.DeleteTaxonOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
75 * @throws ExecutionException
78 public void testRedoIProgressMonitorIAdaptable() throws ExecutionException
{
80 operation
.execute(monitor
, info
);
82 Assert
.assertTrue(taxon
.getTaxonomicChildren().size() == 0);
83 Assert
.assertTrue(taxon
.getTaxonomicChildrenCount() == 0);