ref #9359 upgrade TaxEditor to log4j2
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / test / java / eu / etaxonomy / taxeditor / editor / name / operation / DeleteMisapplicationOperationTest.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
8 */
9 package eu.etaxonomy.taxeditor.editor.name.operation;
10
11 import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
12 import org.eclipse.core.commands.ExecutionException;
13 import org.junit.Assert;
14 import org.junit.BeforeClass;
15 import org.junit.Test;
16
17 import eu.etaxonomy.cdm.model.common.ICdmBase;
18 import eu.etaxonomy.cdm.model.taxon.Taxon;
19 import eu.etaxonomy.taxeditor.store.operations.AbstractTaxeditorOperationTestBase;
20
21 /**
22 * @author n.hoffmann
23 * @created 08.04.2009
24 */
25 public class DeleteMisapplicationOperationTest extends AbstractTaxeditorOperationTestBase{
26
27 private static final Logger logger = LogManager.getLogger(DeleteMisapplicationOperationTest.class);
28
29 private static Taxon taxon;
30 private static Taxon misapplication;
31
32 @BeforeClass
33 public static void setUpBeforeClass() throws Exception {
34
35 taxon = Taxon.NewInstance(null, null);
36 misapplication = Taxon.NewInstance(null, null);
37
38 taxon.addMisappliedName(misapplication, null, null);
39
40 operation = new DeleteMisapplicationOperation("", undoContext, null, taxon, misapplication, postOperation, null, null);
41
42 }
43
44 @Test
45 public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException {
46 operation.execute(monitor, info);
47
48 Assert.assertTrue(taxon.getMisappliedNames(false).size() == 0);
49 }
50
51 @Test
52 public void testUndoIProgressMonitorIAdaptable() throws ExecutionException {
53 operation.undo(monitor, info);
54
55 Assert.assertEquals(misapplication, taxon.getMisappliedNames(false).toArray(new Taxon[0])[0]);
56 }
57
58 @Test
59 public void testRedoIProgressMonitorIAdaptable() throws ExecutionException {
60 operation.redo(monitor, info);
61
62 Assert.assertTrue(taxon.getMisappliedNames(false).size() == 0);
63 }
64
65 @Test
66 public void testPostExecute() {
67 // TODO there is not post operation functionality for this class
68 // at the moment. Implement test when there is.
69 logger.warn("No post operation functionality for this class");
70 }
71 }