diff options
| author | Dirk Fauth | 2022-12-21 10:51:20 +0000 |
|---|---|---|
| committer | Dirk Fauth | 2022-12-30 12:14:06 +0000 |
| commit | ed66565db3d4b09d8a16d02f4336e098a4f93ae1 (patch) | |
| tree | 66800bb8865a6a087050191a63229bfb85e48489 | |
| parent | bc4dfb5891f1081e4617ce4a404019728b15eb60 (diff) | |
| download | org.eclipse.nebula.widgets.nattable-ed66565db3d4b09d8a16d02f4336e098a4f93ae1.tar.gz org.eclipse.nebula.widgets.nattable-ed66565db3d4b09d8a16d02f4336e098a4f93ae1.tar.xz org.eclipse.nebula.widgets.nattable-ed66565db3d4b09d8a16d02f4336e098a4f93ae1.zip | |
Bug 581255 - Update test plugins to JUnit 5
Updated all tests to JUnit 5 and Tycho to 3.0.1
Signed-off-by: Dirk Fauth <dirk.fauth@googlemail.com>
Change-Id: I432a7ea19cbe5b9f4e7e773258a982b86ff35c6f
279 files changed, 3916 insertions, 4112 deletions
diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml index 3f486b3e..f5bf8ddd 100644 --- a/.mvn/extensions.xml +++ b/.mvn/extensions.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <extensions> <extension> - <groupId>org.eclipse.tycho.extras</groupId> - <artifactId>tycho-pomless</artifactId> - <version>2.0.0</version> + <groupId>org.eclipse.tycho</groupId> + <artifactId>tycho-build</artifactId> + <version>3.0.1</version> </extension> </extensions>
\ No newline at end of file diff --git a/org.eclipse.nebula.widgets.nattable.core.test/.classpath b/org.eclipse.nebula.widgets.nattable.core.test/.classpath index b629a6a2..22f30643 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/.classpath +++ b/org.eclipse.nebula.widgets.nattable.core.test/.classpath @@ -3,6 +3,5 @@ <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/org.eclipse.nebula.widgets.nattable.core.test/META-INF/MANIFEST.MF b/org.eclipse.nebula.widgets.nattable.core.test/META-INF/MANIFEST.MF index 9d88d34d..15264292 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/META-INF/MANIFEST.MF +++ b/org.eclipse.nebula.widgets.nattable.core.test/META-INF/MANIFEST.MF @@ -10,11 +10,10 @@ Import-Package: org.eclipse.core.commands.common, org.eclipse.nebula.widgets.nattable.dataset.car;version="1.5.0", org.eclipse.nebula.widgets.nattable.dataset.fixture.data, org.eclipse.nebula.widgets.nattable.dataset.person, - org.junit.jupiter.api;version="5.5.1", - org.junit.jupiter.api.function;version="5.5.1", + org.junit.jupiter.api;version="5.9.1", + org.junit.jupiter.api.function;version="5.9.1", org.opentest4j;version="1.2.0", org.osgi.framework -Require-Bundle: org.junit;bundle-version="4.12.0" Export-Package: org.eclipse.nebula.widgets.nattable.test.fixture, org.eclipse.nebula.widgets.nattable.test.fixture.command, org.eclipse.nebula.widgets.nattable.test.fixture.data, diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/EventConflaterChainTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/EventConflaterChainTest.java index 4b8f13d8..f42906dc 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/EventConflaterChainTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/EventConflaterChainTest.java @@ -12,15 +12,15 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.conflation.EventConflaterChain; import org.eclipse.nebula.widgets.nattable.conflation.VisualChangeEventConflater; import org.eclipse.nebula.widgets.nattable.test.fixture.LayerEventFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class EventConflaterChainTest { @@ -29,7 +29,7 @@ public class EventConflaterChainTest { private VisualChangeEventConflater conflater2; private NatTableFixture natTableFixture; - @Before + @BeforeEach public void setup() { this.conflaterChain = new EventConflaterChain(10, 10); this.natTableFixture = new NatTableFixture(); @@ -63,7 +63,7 @@ public class EventConflaterChainTest { assertEquals(0, this.conflater2.getCount()); } - @After + @AfterEach public void teardown() { this.conflaterChain.stop(); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/NatTableTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/NatTableTest.java index 168f8966..e219df06 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/NatTableTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/NatTableTest.java @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.nebula.widgets.nattable.command.DisposeResourcesCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.LayerEventFixture; @@ -22,15 +22,15 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class NatTableTest { private NatTable natTable; private DataLayerFixture underlyingLayerFixture; - @Before + @BeforeEach public void setup() { this.underlyingLayerFixture = new DataLayerFixture(10, 5, 100, 20); this.natTable = new NatTable(new Shell(Display.getDefault()), diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/VisualChangeEventConflaterTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/VisualChangeEventConflaterTest.java index 380fe644..caee972b 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/VisualChangeEventConflaterTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/VisualChangeEventConflaterTest.java @@ -12,13 +12,13 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.conflation.EventConflaterChain; import org.eclipse.nebula.widgets.nattable.conflation.VisualChangeEventConflater; import org.eclipse.nebula.widgets.nattable.test.fixture.LayerEventFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class VisualChangeEventConflaterTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/blink/BlinkLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/blink/BlinkLayerTest.java index 5ba87e3b..ea308879 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/blink/BlinkLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/blink/BlinkLayerTest.java @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.blink; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; @@ -34,8 +34,8 @@ import org.eclipse.nebula.widgets.nattable.layer.event.PropertyUpdateEvent; import org.eclipse.nebula.widgets.nattable.style.DisplayMode; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.swt.widgets.Display; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class BlinkLayerTest { @@ -52,7 +52,7 @@ public class BlinkLayerTest { private PropertyChangeListener propertyChangeListener; private Display display; - @Before + @BeforeEach public void setUp() { this.display = Display.getDefault(); this.dataList = new LinkedList<BlinkingRowDataFixture>(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/blink/UpdateEventsCacheTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/blink/UpdateEventsCacheTest.java index 2999b065..e30fccb4 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/blink/UpdateEventsCacheTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/blink/UpdateEventsCacheTest.java @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.blink; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.Serializable; import java.util.concurrent.Executors; @@ -23,8 +23,8 @@ import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture; import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture; import org.eclipse.nebula.widgets.nattable.layer.event.PropertyUpdateEvent; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class UpdateEventsCacheTest { @@ -36,7 +36,7 @@ public class UpdateEventsCacheTest { private RowDataFixture bean2; private DataLayerFixture layerFixture = new DataLayerFixture(); - @Before + @BeforeEach public void setup() { this.cache = new UpdateEventsCache<RowDataFixture>( new IRowIdAccessor<RowDataFixture>() { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnCategories/ChooseColumnsFromCategoriesCommandHandlerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnCategories/ChooseColumnsFromCategoriesCommandHandlerTest.java index 33b3f839..d89851f4 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnCategories/ChooseColumnsFromCategoriesCommandHandlerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnCategories/ChooseColumnsFromCategoriesCommandHandlerTest.java @@ -13,8 +13,8 @@ package org.eclipse.nebula.widgets.nattable.columnCategories; import static org.eclipse.nebula.widgets.nattable.util.ArrayUtil.asIntegerList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; import java.util.List; @@ -26,15 +26,15 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.ColumnCategoriesModelFix import org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnHeaderLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnHideShowLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ChooseColumnsFromCategoriesCommandHandlerTest { private ChooseColumnsFromCategoriesCommandHandler commandHandler; private ColumnHideShowLayerFixture hideShowLayerFixture; - @Before + @BeforeEach public void setup() { this.hideShowLayerFixture = new ColumnHideShowLayerFixture(); this.commandHandler = new ChooseColumnsFromCategoriesCommandHandler( diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnCategories/ColumnCategoriesLabelProviderTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnCategories/ColumnCategoriesLabelProviderTest.java index 5bc887f9..69235c05 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnCategories/ColumnCategoriesLabelProviderTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnCategories/ColumnCategoriesLabelProviderTest.java @@ -13,7 +13,7 @@ package org.eclipse.nebula.widgets.nattable.columnCategories; import static org.eclipse.nebula.widgets.nattable.test.fixture.ColumnCategoriesModelFixture.CATEGORY_B1_LABEL; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.List; @@ -22,15 +22,15 @@ import org.eclipse.nebula.widgets.nattable.columnCategories.Node.Type; import org.eclipse.nebula.widgets.nattable.columnCategories.gui.ColumnCategoriesLabelProvider; import org.eclipse.nebula.widgets.nattable.columnChooser.ColumnEntry; import org.eclipse.nebula.widgets.nattable.test.fixture.ColumnEntriesFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnCategoriesLabelProviderTest { private List<ColumnEntry> hiddenEntries; private ColumnCategoriesLabelProvider labelProvider; - @Before + @BeforeEach public void setup() { this.hiddenEntries = ColumnEntriesFixture.getEntriesWithEvenIndexes(); this.labelProvider = new ColumnCategoriesLabelProvider(this.hiddenEntries); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnCategories/ColumnCategoriesModelTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnCategories/ColumnCategoriesModelTest.java index f68e7bff..78a8fcba 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnCategories/ColumnCategoriesModelTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnCategories/ColumnCategoriesModelTest.java @@ -12,18 +12,18 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.columnCategories; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.nebula.widgets.nattable.test.fixture.ColumnCategoriesModelFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnCategoriesModelTest { private ColumnCategoriesModel model; - @Before + @BeforeEach public void setup() { this.model = new ColumnCategoriesModelFixture(); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnCategories/TreeTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnCategories/TreeTest.java index 209fc794..9eb5336e 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnCategories/TreeTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnCategories/TreeTest.java @@ -12,19 +12,19 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.columnCategories; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class TreeTest { private Tree tree; - @Before + @BeforeEach public void setup() { this.tree = new Tree(); @@ -48,10 +48,10 @@ public class TreeTest { @Test public void basics() throws Exception { - Assert.assertEquals("R", this.tree.getRootElement().getData()); - Assert.assertEquals(3, this.tree.getRootElement().getNumberOfChildren()); - Assert.assertEquals(9, this.tree.toList().size()); - Assert.assertEquals( + assertEquals("R", this.tree.getRootElement().getData()); + assertEquals(3, this.tree.getRootElement().getNumberOfChildren()); + assertEquals(9, this.tree.toList().size()); + assertEquals( "[{UNKNOWN,R,[a,b,c]}, {UNKNOWN,a,[]}, {UNKNOWN,b,[b1,b2,b3]}, {UNKNOWN,b1,[]}, {UNKNOWN,b2,[]}, {UNKNOWN,b3,[b3a,b3b]}, {UNKNOWN,b3a,[]}, {UNKNOWN,b3b,[]}, {UNKNOWN,c,[]}]", this.tree.toString()); } @@ -59,21 +59,21 @@ public class TreeTest { @Test public void findParent() throws Exception { Node found = this.tree.find("c"); - Assert.assertNotNull(found); - Assert.assertEquals("R", found.getParent().getData()); + assertNotNull(found); + assertEquals("R", found.getParent().getData()); found = this.tree.find("b3b"); - Assert.assertEquals("b3", found.getParent().getData()); + assertEquals("b3", found.getParent().getData()); } @Test public void findElements() throws Exception { Node found = this.tree.find(this.tree.getRootElement(), "b2"); - Assert.assertNotNull(found); - Assert.assertEquals("b2", found.getData()); + assertNotNull(found); + assertEquals("b2", found.getData()); found = this.tree.find(this.tree.getRootElement(), "b3b"); - Assert.assertNotNull(found); + assertNotNull(found); } @Test @@ -81,12 +81,12 @@ public class TreeTest { Node a = this.tree.find("a"); a.addChild(newNode("a1")); a.addChild(newNode("a2")); - Assert.assertEquals(2, a.getNumberOfChildren()); - Assert.assertEquals("{UNKNOWN,a,[a1,a2]}", a.toString()); + assertEquals(2, a.getNumberOfChildren()); + assertEquals("{UNKNOWN,a,[a1,a2]}", a.toString()); a.insertChildAt(1, newNode("a11")); - Assert.assertEquals(3, a.getNumberOfChildren()); - Assert.assertEquals("{UNKNOWN,a,[a1,a11,a2]}", a.toString()); + assertEquals(3, a.getNumberOfChildren()); + assertEquals("{UNKNOWN,a,[a1,a11,a2]}", a.toString()); } @Test diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnChooser/ColumnChooserUtilsTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnChooser/ColumnChooserUtilsTest.java index edb08684..706b6f0d 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnChooser/ColumnChooserUtilsTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnChooser/ColumnChooserUtilsTest.java @@ -14,10 +14,10 @@ package org.eclipse.nebula.widgets.nattable.columnChooser; import static org.eclipse.nebula.widgets.nattable.columnChooser.ColumnChooserUtils.getColumnLabel; import static org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnHeaderLayerFixture.getDataLayer; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; import java.util.List; @@ -29,14 +29,14 @@ import org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.test.fixture.ColumnEntriesFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnHeaderLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnChooserUtilsTest { private List<ColumnEntry> entriesFixture; - @Before + @BeforeEach public void setup() { this.entriesFixture = ColumnEntriesFixture.getEntriesWithOddIndexes(); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnChooser/gui/ColumnChooserDialogTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnChooser/gui/ColumnChooserDialogTest.java index 3a6aacf0..e73c29cb 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnChooser/gui/ColumnChooserDialogTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnChooser/gui/ColumnChooserDialogTest.java @@ -13,6 +13,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.columnChooser.gui; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -26,11 +29,10 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.group.ColumnGroupModelFi import org.eclipse.nebula.widgets.nattable.util.ArrayUtil; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.TreeItem; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; public class ColumnChooserDialogTest { @@ -58,7 +60,7 @@ public class ColumnChooserDialogTest { private ColumnChooserDialog testDialog; private TestTreeListener testListener; - @Before + @BeforeEach public void setup() { this.shell = new Shell(); this.testDialog = new ColumnChooserDialog(this.shell, "", ""); @@ -70,21 +72,21 @@ public class ColumnChooserDialogTest { this.testDialog.populateSelectedTree(this.visibleEntries, this.columnGroupModel); } - @After + @AfterEach public void tearDown() { this.testDialog.close(); this.shell.dispose(); } - @Ignore + @Disabled public void singleColumnMovedDown() throws Exception { this.testDialog.setSelectionIncludingNested(Arrays.asList(2)); this.testDialog.moveSelectedDown(); List<List<Integer>> fromPositions = this.testListener.fromPositions; - Assert.assertEquals(1, fromPositions.size()); - Assert.assertEquals(2, fromPositions.get(0)); + assertEquals(1, fromPositions.size()); + assertEquals(2, fromPositions.get(0)); } @Test @@ -94,10 +96,10 @@ public class ColumnChooserDialogTest { List<TreeItem> selectedLeaves = ArrayUtil.asList(this.testDialog .getSelectedTree().getSelection()); - Assert.assertEquals(3, selectedLeaves.size()); - Assert.assertEquals("G1", selectedLeaves.get(0).getText()); - Assert.assertEquals(this.entry2.getLabel(), selectedLeaves.get(1).getText()); - Assert.assertEquals("G2", selectedLeaves.get(2).getText()); + assertEquals(3, selectedLeaves.size()); + assertEquals("G1", selectedLeaves.get(0).getText()); + assertEquals(this.entry2.getLabel(), selectedLeaves.get(1).getText()); + assertEquals("G2", selectedLeaves.get(2).getText()); } @Test @@ -108,25 +110,25 @@ public class ColumnChooserDialogTest { List<Integer> indexesOfSelectedLeaves = this.testDialog .getIndexesOfSelectedLeaves(this.testDialog.getSelectedTree()); - Assert.assertEquals(3, indexesOfSelectedLeaves.size()); - Assert.assertEquals(0, indexesOfSelectedLeaves.get(0).intValue()); - Assert.assertEquals(1, indexesOfSelectedLeaves.get(1).intValue()); - Assert.assertEquals(2, indexesOfSelectedLeaves.get(2).intValue()); + assertEquals(3, indexesOfSelectedLeaves.size()); + assertEquals(0, indexesOfSelectedLeaves.get(0).intValue()); + assertEquals(1, indexesOfSelectedLeaves.get(1).intValue()); + assertEquals(2, indexesOfSelectedLeaves.get(2).intValue()); } @Test public void populateTree() throws Exception { this.columnGroupModel.getColumnGroupByIndex(0).toggleCollapsed(); - Assert.assertEquals(9, this.testDialog.getSelectedTree().getItemCount()); + assertEquals(9, this.testDialog.getSelectedTree().getItemCount()); TreeItem item = this.testDialog.getSelectedTree().getItem(0); - Assert.assertTrue(item.getData() instanceof ColumnGroupEntry); + assertTrue(item.getData() instanceof ColumnGroupEntry); item = this.testDialog.getSelectedTree().getItem(1); - Assert.assertTrue(item.getData() instanceof ColumnEntry); + assertTrue(item.getData() instanceof ColumnEntry); item = this.testDialog.getSelectedTree().getItem(2); - Assert.assertTrue(item.getData() instanceof ColumnGroupEntry); + assertTrue(item.getData() instanceof ColumnGroupEntry); } @Test @@ -139,8 +141,8 @@ public class ColumnChooserDialogTest { helper.getDialog().moveSelectedToTop(); // then - Assert.assertEquals((Integer) 2, helper.getListener().fromPositions.get(0).get(0)); - Assert.assertEquals((Integer) 0, helper.getListener().toPositions.get(0)); + assertEquals((Integer) 2, helper.getListener().fromPositions.get(0).get(0)); + assertEquals((Integer) 0, helper.getListener().toPositions.get(0)); } @Test @@ -153,8 +155,8 @@ public class ColumnChooserDialogTest { helper.getDialog().moveSelectedToTop(); // then - Assert.assertEquals((Integer) 1, helper.getListener().fromPositions.get(0).get(0)); - Assert.assertEquals((Integer) 0, helper.getListener().toPositions.get(0)); + assertEquals((Integer) 1, helper.getListener().fromPositions.get(0).get(0)); + assertEquals((Integer) 0, helper.getListener().toPositions.get(0)); } @Test @@ -167,8 +169,8 @@ public class ColumnChooserDialogTest { helper.getDialog().moveSelectedToTop(); // then - Assert.assertEquals((Integer) 2, helper.getListener().fromPositions.get(0).get(0)); - Assert.assertEquals((Integer) 1, helper.getListener().toPositions.get(0)); + assertEquals((Integer) 2, helper.getListener().fromPositions.get(0).get(0)); + assertEquals((Integer) 1, helper.getListener().toPositions.get(0)); } @Test @@ -181,9 +183,9 @@ public class ColumnChooserDialogTest { helper.getDialog().moveSelectedToTop(); // then - Assert.assertEquals((Integer) 2, helper.getListener().fromPositions.get(0).get(0)); - Assert.assertEquals((Integer) 3, helper.getListener().fromPositions.get(0).get(1)); - Assert.assertEquals((Integer) 0, helper.getListener().toPositions.get(0)); + assertEquals((Integer) 2, helper.getListener().fromPositions.get(0).get(0)); + assertEquals((Integer) 3, helper.getListener().fromPositions.get(0).get(1)); + assertEquals((Integer) 0, helper.getListener().toPositions.get(0)); } @Test @@ -196,9 +198,9 @@ public class ColumnChooserDialogTest { helper.getDialog().moveSelectedToTop(); // then - Assert.assertEquals((Integer) 2, helper.getListener().fromPositions.get(0).get(0)); - Assert.assertEquals((Integer) 3, helper.getListener().fromPositions.get(0).get(1)); - Assert.assertEquals((Integer) 0, helper.getListener().toPositions.get(0)); + assertEquals((Integer) 2, helper.getListener().fromPositions.get(0).get(0)); + assertEquals((Integer) 3, helper.getListener().fromPositions.get(0).get(1)); + assertEquals((Integer) 0, helper.getListener().toPositions.get(0)); } @Test @@ -211,9 +213,9 @@ public class ColumnChooserDialogTest { helper.getDialog().moveSelectedToTop(); // then - Assert.assertEquals((Integer) 4, helper.getListener().fromPositions.get(0).get(0)); - Assert.assertEquals((Integer) 5, helper.getListener().fromPositions.get(0).get(1)); - Assert.assertEquals((Integer) 2, helper.getListener().toPositions.get(0)); + assertEquals((Integer) 4, helper.getListener().fromPositions.get(0).get(0)); + assertEquals((Integer) 5, helper.getListener().fromPositions.get(0).get(1)); + assertEquals((Integer) 2, helper.getListener().toPositions.get(0)); } @Test @@ -226,8 +228,8 @@ public class ColumnChooserDialogTest { helper.getDialog().moveSelectedToBottom(); // then - Assert.assertEquals((Integer) 0, helper.getListener().fromPositions.get(0).get(0)); - Assert.assertEquals((Integer) 2, helper.getListener().toPositions.get(0)); + assertEquals((Integer) 0, helper.getListener().fromPositions.get(0).get(0)); + assertEquals((Integer) 2, helper.getListener().toPositions.get(0)); } @Test @@ -240,8 +242,8 @@ public class ColumnChooserDialogTest { helper.getDialog().moveSelectedToBottom(); // then - Assert.assertEquals((Integer) 0, helper.getListener().fromPositions.get(0).get(0)); - Assert.assertEquals((Integer) 1, helper.getListener().toPositions.get(0)); + assertEquals((Integer) 0, helper.getListener().fromPositions.get(0).get(0)); + assertEquals((Integer) 1, helper.getListener().toPositions.get(0)); } @Test @@ -254,8 +256,8 @@ public class ColumnChooserDialogTest { helper.getDialog().moveSelectedToBottom(); // then - Assert.assertEquals((Integer) 1, helper.getListener().fromPositions.get(0).get(0)); - Assert.assertEquals((Integer) 2, helper.getListener().toPositions.get(0)); + assertEquals((Integer) 1, helper.getListener().fromPositions.get(0).get(0)); + assertEquals((Integer) 2, helper.getListener().toPositions.get(0)); } @Test @@ -268,9 +270,9 @@ public class ColumnChooserDialogTest { helper.getDialog().moveSelectedToBottom(); // then - Assert.assertEquals((Integer) 0, helper.getListener().fromPositions.get(0).get(0)); - Assert.assertEquals((Integer) 1, helper.getListener().fromPositions.get(0).get(1)); - Assert.assertEquals((Integer) 5, helper.getListener().toPositions.get(0)); + assertEquals((Integer) 0, helper.getListener().fromPositions.get(0).get(0)); + assertEquals((Integer) 1, helper.getListener().fromPositions.get(0).get(1)); + assertEquals((Integer) 5, helper.getListener().toPositions.get(0)); } @Test @@ -283,9 +285,9 @@ public class ColumnChooserDialogTest { helper.getDialog().moveSelectedToBottom(); // then - Assert.assertEquals((Integer) 0, helper.getListener().fromPositions.get(0).get(0)); - Assert.assertEquals((Integer) 1, helper.getListener().fromPositions.get(0).get(1)); - Assert.assertEquals((Integer) 3, helper.getListener().toPositions.get(0)); + assertEquals((Integer) 0, helper.getListener().fromPositions.get(0).get(0)); + assertEquals((Integer) 1, helper.getListener().fromPositions.get(0).get(1)); + assertEquals((Integer) 3, helper.getListener().toPositions.get(0)); } @Test @@ -298,9 +300,9 @@ public class ColumnChooserDialogTest { helper.getDialog().moveSelectedToBottom(); // then - Assert.assertEquals((Integer) 2, helper.getListener().fromPositions.get(0).get(0)); - Assert.assertEquals((Integer) 3, helper.getListener().fromPositions.get(0).get(1)); - Assert.assertEquals((Integer) 5, helper.getListener().toPositions.get(0)); + assertEquals((Integer) 2, helper.getListener().fromPositions.get(0).get(0)); + assertEquals((Integer) 3, helper.getListener().fromPositions.get(0).get(1)); + assertEquals((Integer) 5, helper.getListener().toPositions.get(0)); } /** diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/command/CommandPropagationTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/command/CommandPropagationTest.java index 15a201f5..98ac90b8 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/command/CommandPropagationTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/command/CommandPropagationTest.java @@ -12,15 +12,16 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.command; +import static org.junit.jupiter.api.Assertions.assertTrue; + import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.layer.ILayer; import org.eclipse.nebula.widgets.nattable.test.fixture.command.CommandHandlerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.command.LayerCommandFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.GenericLayerFixture; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; //Test AbstractLayer implementations of command propagation public class CommandPropagationTest { @@ -28,21 +29,21 @@ public class CommandPropagationTest { private DataLayer underlyingLayer = new DataLayerFixture(10, 5, 100, 20); private ILayer layer = new GenericLayerFixture(this.underlyingLayer); - @Before + @BeforeEach public void setUp() { this.underlyingLayer.registerCommandHandler(new CommandHandlerFixture()); } @Test public void shouldHandleGenericLayerCommand() { - Assert.assertTrue(this.layer.doCommand(new LayerCommandFixture())); + assertTrue(this.layer.doCommand(new LayerCommandFixture())); } @Test public void shouldPropagateToUnderlyingLayer() { LayerCommandFixture command = new LayerCommandFixture(); this.layer.doCommand(command); - Assert.assertTrue(command.getTargetLayer() instanceof DataLayerFixture); + assertTrue(command.getTargetLayer() instanceof DataLayerFixture); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/config/ConfigRegistryTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/config/ConfigRegistryTest.java index 1e6f0059..1f39ee4e 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/config/ConfigRegistryTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/config/ConfigRegistryTest.java @@ -12,11 +12,11 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.config; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.style.ConfigAttribute; import org.eclipse.nebula.widgets.nattable.style.DisplayMode; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ConfigRegistryTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/config/DefaultComparatorTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/config/DefaultComparatorTest.java index 34d45638..36ac1781 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/config/DefaultComparatorTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/config/DefaultComparatorTest.java @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.config; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DefaultComparatorTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/coordinate/IndexCoordinateTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/coordinate/IndexCoordinateTest.java index 86ca0f5d..f0d6867b 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/coordinate/IndexCoordinateTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/coordinate/IndexCoordinateTest.java @@ -12,17 +12,17 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.coordinate; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class IndexCoordinateTest { private IndexCoordinate i1; private IndexCoordinate i2; - @Before + @BeforeEach public void setup() { this.i1 = new IndexCoordinate(1, 2); this.i2 = new IndexCoordinate(1, 2); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/coordinate/PositionCoordinateTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/coordinate/PositionCoordinateTest.java index 45a6b96e..38be4aa4 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/coordinate/PositionCoordinateTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/coordinate/PositionCoordinateTest.java @@ -12,19 +12,19 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.coordinate; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.layer.ILayer; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class PositionCoordinateTest { private PositionCoordinate p1; private PositionCoordinate p2; - @Before + @BeforeEach public void setup() { ILayer layer = new DataLayerFixture(); this.p1 = new PositionCoordinate(layer, 1, 2); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/coordinate/PositionUtilTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/coordinate/PositionUtilTest.java index 4bfe4231..e5667cdc 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/coordinate/PositionUtilTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/coordinate/PositionUtilTest.java @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.coordinate; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.ArrayList; import java.util.Arrays; @@ -23,7 +23,7 @@ import java.util.List; import java.util.Set; import org.eclipse.nebula.widgets.nattable.util.ObjectUtils; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PositionUtilTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/coordinate/RangeTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/coordinate/RangeTest.java index 6bd687ac..99c29dd0 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/coordinate/RangeTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/coordinate/RangeTest.java @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.coordinate; -import static org.junit.Assert.assertFalse; +import static org.junit.jupiter.api.Assertions.assertFalse; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class RangeTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/copy/command/CopyDataCommandHandlerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/copy/command/CopyDataCommandHandlerTest.java index 295e1a5c..573f92eb 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/copy/command/CopyDataCommandHandlerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/copy/command/CopyDataCommandHandlerTest.java @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.copy.command; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import java.util.HashSet; import java.util.Iterator; @@ -34,8 +34,8 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class CopyDataCommandHandlerTest { @@ -43,7 +43,7 @@ public class CopyDataCommandHandlerTest { private SelectionLayer selectionLayer; private CopyDataCommandHandler commandHandler; - @Before + @BeforeEach public void setUp() { final IDataProvider bodyDataProvider = new DataProviderFixture(10, 10); this.gridLayer = new DefaultGridLayer( diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/AutomaticSpanningDataProviderTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/AutomaticSpanningDataProviderTest.java index 9a8dbaf8..c75e6039 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/AutomaticSpanningDataProviderTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/AutomaticSpanningDataProviderTest.java @@ -12,11 +12,11 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.data; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.nebula.widgets.nattable.grid.data.DummyBodyDataProvider; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class AutomaticSpanningDataProviderTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/ExtendedReflectiveColumnPropertyAccessorTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/ExtendedReflectiveColumnPropertyAccessorTest.java index 04bcbb10..f5618f12 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/ExtendedReflectiveColumnPropertyAccessorTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/ExtendedReflectiveColumnPropertyAccessorTest.java @@ -12,8 +12,8 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.data; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import java.util.Date; diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/FilterListDataProviderTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/FilterListDataProviderTest.java index a1e67aa4..43279b63 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/FilterListDataProviderTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/FilterListDataProviderTest.java @@ -12,21 +12,21 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.data; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.List; import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture; import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class FilterListDataProviderTest { private List<RowDataFixture> values; private IRowDataProvider<RowDataFixture> dataProvider; - @Before + @BeforeEach public void setup() { this.values = RowDataListFixture.getList(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/ReflectiveColumnAccessorTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/ReflectiveColumnAccessorTest.java index e0c574d9..ade38375 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/ReflectiveColumnAccessorTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/ReflectiveColumnAccessorTest.java @@ -12,16 +12,16 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.data; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ReflectiveColumnAccessorTest { private ReflectiveColumnPropertyAccessor<TestBean> accessor; - @Before + @BeforeEach public void setup() { this.accessor = new ReflectiveColumnPropertyAccessor<>( new String[] { "stringField", "booleanField", "floatField" }); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/command/RowDeleteCommandTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/command/RowDeleteCommandTest.java index 3a36f539..40e8b022 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/command/RowDeleteCommandTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/command/RowDeleteCommandTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2020 Dirk Fauth. + * Copyright (c) 2018, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.data.command; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Iterator; import java.util.List; @@ -27,8 +27,8 @@ import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.layer.event.RowObjectDeleteEvent; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowDeleteCommandTest { @@ -37,7 +37,7 @@ public class RowDeleteCommandTest { private DataLayer dataLayer; private LayerListenerFixture listener; - @Before + @BeforeEach public void setup() { this.dataModel = PersonService.getFixedPersons(); this.dataProvider = new ListDataProvider<>( @@ -100,9 +100,9 @@ public class RowDeleteCommandTest { assertTrue(this.listener.containsInstanceOf(RowObjectDeleteEvent.class)); RowObjectDeleteEvent event = (RowObjectDeleteEvent) this.listener.getReceivedEvents().get(0); assertEquals(3, event.getDeletedRowIndexes().size()); - assertTrue("Index 10 not included", event.getDeletedRowIndexes().contains(10)); - assertTrue("Index 11 not included", event.getDeletedRowIndexes().contains(11)); - assertTrue("Index 12 not included", event.getDeletedRowIndexes().contains(12)); + assertTrue(event.getDeletedRowIndexes().contains(10), "Index 10 not included"); + assertTrue(event.getDeletedRowIndexes().contains(11), "Index 11 not included"); + assertTrue(event.getDeletedRowIndexes().contains(12), "Index 12 not included"); assertEquals(3, event.getDeletedObjects().size()); assertEquals(toDelete1, event.getDeletedObjects().get(10)); assertEquals(toDelete2, event.getDeletedObjects().get(11)); @@ -133,10 +133,10 @@ public class RowDeleteCommandTest { assertTrue(this.listener.containsInstanceOf(RowObjectDeleteEvent.class)); RowObjectDeleteEvent event = (RowObjectDeleteEvent) this.listener.getReceivedEvents().get(0); assertEquals(4, event.getDeletedRowIndexes().size()); - assertTrue("Index 5 not included", event.getDeletedRowIndexes().contains(5)); - assertTrue("Index 6 not included", event.getDeletedRowIndexes().contains(6)); - assertTrue("Index 10 not included", event.getDeletedRowIndexes().contains(10)); - assertTrue("Index 12 not included", event.getDeletedRowIndexes().contains(12)); + assertTrue(event.getDeletedRowIndexes().contains(5), "Index 5 not included"); + assertTrue(event.getDeletedRowIndexes().contains(6), "Index 6 not included"); + assertTrue(event.getDeletedRowIndexes().contains(10), "Index 10 not included"); + assertTrue(event.getDeletedRowIndexes().contains(12), "Index 12 not included"); assertEquals(4, event.getDeletedObjects().size()); assertEquals(toDelete1, event.getDeletedObjects().get(5)); assertEquals(toDelete2, event.getDeletedObjects().get(6)); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/command/RowInsertCommandTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/command/RowInsertCommandTest.java index f70f43a8..8e300f05 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/command/RowInsertCommandTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/command/RowInsertCommandTest.java @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.data.command; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Date; import java.util.List; @@ -42,8 +42,8 @@ import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowInsertCommandTest { @@ -53,7 +53,7 @@ public class RowInsertCommandTest { private ViewportLayer viewportLayer; private LayerListenerFixture listener; - @Before + @BeforeEach public void setup() { this.dataModel = PersonService.getFixedPersons(); this.dataProvider = new ListDataProvider<>( diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/command/RowObjectDeleteCommandTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/command/RowObjectDeleteCommandTest.java index 4bec43e6..dc04ca03 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/command/RowObjectDeleteCommandTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/command/RowObjectDeleteCommandTest.java @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.data.command; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; import java.util.Iterator; @@ -28,8 +28,8 @@ import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.layer.event.RowObjectDeleteEvent; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowObjectDeleteCommandTest { @@ -38,7 +38,7 @@ public class RowObjectDeleteCommandTest { private DataLayer dataLayer; private LayerListenerFixture listener; - @Before + @BeforeEach public void setup() { this.dataModel = PersonService.getFixedPersons(); this.dataProvider = new ListDataProvider<>( @@ -101,9 +101,9 @@ public class RowObjectDeleteCommandTest { assertTrue(this.listener.containsInstanceOf(RowObjectDeleteEvent.class)); RowObjectDeleteEvent event = (RowObjectDeleteEvent) this.listener.getReceivedEvents().get(0); assertEquals(3, event.getDeletedRowIndexes().size()); - assertTrue("Index 10 not included", event.getDeletedRowIndexes().contains(10)); - assertTrue("Index 11 not included", event.getDeletedRowIndexes().contains(11)); - assertTrue("Index 12 not included", event.getDeletedRowIndexes().contains(12)); + assertTrue(event.getDeletedRowIndexes().contains(10), "Index 10 not included"); + assertTrue(event.getDeletedRowIndexes().contains(11), "Index 11 not included"); + assertTrue(event.getDeletedRowIndexes().contains(12), "Index 12 not included"); assertEquals(3, event.getDeletedObjects().size()); assertEquals(toDelete1, event.getDeletedObjects().get(10)); assertEquals(toDelete2, event.getDeletedObjects().get(11)); @@ -134,10 +134,10 @@ public class RowObjectDeleteCommandTest { assertTrue(this.listener.containsInstanceOf(RowObjectDeleteEvent.class)); RowObjectDeleteEvent event = (RowObjectDeleteEvent) this.listener.getReceivedEvents().get(0); assertEquals(4, event.getDeletedRowIndexes().size()); - assertTrue("Index 5 not included", event.getDeletedRowIndexes().contains(5)); - assertTrue("Index 6 not included", event.getDeletedRowIndexes().contains(6)); - assertTrue("Index 10 not included", event.getDeletedRowIndexes().contains(10)); - assertTrue("Index 12 not included", event.getDeletedRowIndexes().contains(12)); + assertTrue(event.getDeletedRowIndexes().contains(5), "Index 5 not included"); + assertTrue(event.getDeletedRowIndexes().contains(6), "Index 6 not included"); + assertTrue(event.getDeletedRowIndexes().contains(10), "Index 10 not included"); + assertTrue(event.getDeletedRowIndexes().contains(12), "Index 12 not included"); assertEquals(4, event.getDeletedObjects().size()); assertEquals(toDelete1, event.getDeletedObjects().get(5)); assertEquals(toDelete2, event.getDeletedObjects().get(6)); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultBigDecimalDisplayConverterTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultBigDecimalDisplayConverterTest.java index 5b942862..9991b6e5 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultBigDecimalDisplayConverterTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultBigDecimalDisplayConverterTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,18 +12,19 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.data.convert; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Locale; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; public class DefaultBigDecimalDisplayConverterTest { @@ -31,13 +32,13 @@ public class DefaultBigDecimalDisplayConverterTest { private static Locale defaultLocale; - @BeforeClass + @BeforeAll public static void setup() { defaultLocale = Locale.getDefault(); Locale.setDefault(new Locale("en")); } - @AfterClass + @AfterAll public static void tearDown() { Locale.setDefault(defaultLocale); } @@ -64,9 +65,9 @@ public class DefaultBigDecimalDisplayConverterTest { assertNull(this.bigDecConverter.displayToCanonicalValue("")); } - @Test(expected = ConversionFailedException.class) + @Test public void testConversionException() { - this.bigDecConverter.displayToCanonicalValue("abc"); + assertThrows(ConversionFailedException.class, () -> this.bigDecConverter.displayToCanonicalValue("abc")); } @Test diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultBigIntegerDisplayConverterTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultBigIntegerDisplayConverterTest.java index fc91df34..6e6263b6 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultBigIntegerDisplayConverterTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultBigIntegerDisplayConverterTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,12 +12,13 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.data.convert; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.math.BigInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DefaultBigIntegerDisplayConverterTest { @@ -43,8 +44,8 @@ public class DefaultBigIntegerDisplayConverterTest { assertNull(this.bigIntConverter.displayToCanonicalValue("")); } - @Test(expected = ConversionFailedException.class) + @Test public void testConversionException() { - this.bigIntConverter.displayToCanonicalValue("abc"); + assertThrows(ConversionFailedException.class, () -> this.bigIntConverter.displayToCanonicalValue("abc")); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultBooleanDisplayConverterTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultBooleanDisplayConverterTest.java index dccaea2a..68809e98 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultBooleanDisplayConverterTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultBooleanDisplayConverterTest.java @@ -12,10 +12,10 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.data.convert; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DefaultBooleanDisplayConverterTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultByteDisplayConverterTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultByteDisplayConverterTest.java index a22a7b38..b14f113a 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultByteDisplayConverterTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultByteDisplayConverterTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,10 +12,11 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.data.convert; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DefaultByteDisplayConverterTest { @@ -41,13 +42,13 @@ public class DefaultByteDisplayConverterTest { assertNull(this.byteConverter.displayToCanonicalValue("")); } - @Test(expected = ConversionFailedException.class) + @Test public void testConversionException() { - this.byteConverter.displayToCanonicalValue("abc"); + assertThrows(ConversionFailedException.class, () -> this.byteConverter.displayToCanonicalValue("abc")); } - @Test(expected = ConversionFailedException.class) + @Test public void testConversionExceptionTooBig() { - this.byteConverter.displayToCanonicalValue("129"); + assertThrows(ConversionFailedException.class, () -> this.byteConverter.displayToCanonicalValue("129")); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultCharacterDisplayConverterTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultCharacterDisplayConverterTest.java index 77307702..d3f29208 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultCharacterDisplayConverterTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultCharacterDisplayConverterTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,10 +12,11 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.data.convert; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DefaultCharacterDisplayConverterTest { @@ -43,9 +44,9 @@ public class DefaultCharacterDisplayConverterTest { assertNull(this.characterConverter.displayToCanonicalValue("")); } - @Test(expected = ConversionFailedException.class) + @Test public void testConversionException() { - this.characterConverter.displayToCanonicalValue("abc"); + assertThrows(ConversionFailedException.class, () -> this.characterConverter.displayToCanonicalValue("abc")); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultDateDisplayConverterTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultDateDisplayConverterTest.java index d3b5c5d8..b77b5f41 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultDateDisplayConverterTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultDateDisplayConverterTest.java @@ -12,14 +12,14 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.data.convert; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DefaultDateDisplayConverterTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultDisplayConverterTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultDisplayConverterTest.java index 26a5ec31..c11b9ea9 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultDisplayConverterTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultDisplayConverterTest.java @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.data.convert; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DefaultDisplayConverterTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultDoubleDisplayConverterTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultDoubleDisplayConverterTest.java index b6166982..65c41597 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultDoubleDisplayConverterTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultDoubleDisplayConverterTest.java @@ -12,16 +12,17 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.data.convert; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.text.NumberFormat; import java.util.Locale; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; public class DefaultDoubleDisplayConverterTest { @@ -29,13 +30,13 @@ public class DefaultDoubleDisplayConverterTest { private static Locale defaultLocale; - @BeforeClass + @BeforeAll public static void setup() { defaultLocale = Locale.getDefault(); Locale.setDefault(new Locale("en")); } - @AfterClass + @AfterAll public static void tearDown() { Locale.setDefault(defaultLocale); } @@ -62,9 +63,9 @@ public class DefaultDoubleDisplayConverterTest { assertNull(this.doubleConverter.displayToCanonicalValue("")); } - @Test(expected = ConversionFailedException.class) + @Test public void testConversionException() { - this.doubleConverter.displayToCanonicalValue("abc"); + assertThrows(ConversionFailedException.class, () -> this.doubleConverter.displayToCanonicalValue("abc")); } @Test @@ -102,10 +103,10 @@ public class DefaultDoubleDisplayConverterTest { assertEquals("1,234.5", this.doubleConverter.canonicalToDisplayValue(Double.valueOf("1234.50"))); } - @Test(expected = ConversionFailedException.class) + @Test public void testFailConvertLocalized() { this.doubleConverter.setNumberFormat(null); - assertEquals(Double.valueOf("1234.50"), this.doubleConverter.displayToCanonicalValue("1,234.50")); + assertThrows(ConversionFailedException.class, () -> this.doubleConverter.displayToCanonicalValue("1,234.50")); } @Test diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultFloatDisplayConverterTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultFloatDisplayConverterTest.java index 8445d9f1..e339ae8a 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultFloatDisplayConverterTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultFloatDisplayConverterTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,16 +12,17 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.data.convert; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.text.NumberFormat; import java.util.Locale; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; public class DefaultFloatDisplayConverterTest { @@ -29,13 +30,13 @@ public class DefaultFloatDisplayConverterTest { private static Locale defaultLocale; - @BeforeClass + @BeforeAll public static void setup() { defaultLocale = Locale.getDefault(); Locale.setDefault(new Locale("en")); } - @AfterClass + @AfterAll public static void tearDown() { Locale.setDefault(defaultLocale); } @@ -62,9 +63,9 @@ public class DefaultFloatDisplayConverterTest { assertNull(this.floatConverter.displayToCanonicalValue("")); } - @Test(expected = ConversionFailedException.class) + @Test public void testConversionException() { - this.floatConverter.displayToCanonicalValue("abc"); + assertThrows(ConversionFailedException.class, () -> this.floatConverter.displayToCanonicalValue("abc")); } @Test @@ -102,10 +103,10 @@ public class DefaultFloatDisplayConverterTest { assertEquals("1,234.5", this.floatConverter.canonicalToDisplayValue(Float.valueOf("1234.50"))); } - @Test(expected = ConversionFailedException.class) + @Test public void testFailConvertLocalized() { this.floatConverter.setNumberFormat(null); - assertEquals(Float.valueOf("1234.50"), this.floatConverter.displayToCanonicalValue("1,234.50")); + assertThrows(ConversionFailedException.class, () -> this.floatConverter.displayToCanonicalValue("1,234.50")); } @Test diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultIntegerDisplayConverterTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultIntegerDisplayConverterTest.java index 6965120f..bab70cee 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultIntegerDisplayConverterTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultIntegerDisplayConverterTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,12 +12,13 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.data.convert; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.text.NumberFormat; import java.util.Locale; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DefaultIntegerDisplayConverterTest { @@ -43,15 +44,15 @@ public class DefaultIntegerDisplayConverterTest { assertEquals(null, this.intConverter.displayToCanonicalValue("")); } - @Test(expected = ConversionFailedException.class) + @Test public void testConversionException() { - this.intConverter.displayToCanonicalValue("abc"); + assertThrows(ConversionFailedException.class, () -> this.intConverter.displayToCanonicalValue("abc")); } - @Test(expected = ConversionFailedException.class) + @Test public void testConversionExceptionTooBig() { this.intConverter.setNumberFormat(null); - this.intConverter.displayToCanonicalValue(Long.valueOf(Integer.MAX_VALUE) + 1); + assertThrows(ConversionFailedException.class, () -> this.intConverter.displayToCanonicalValue(Long.valueOf(Integer.MAX_VALUE) + 1)); } @Test @@ -61,10 +62,10 @@ public class DefaultIntegerDisplayConverterTest { assertEquals("1,234", this.intConverter.canonicalToDisplayValue(Integer.valueOf("1234"))); } - @Test(expected = ConversionFailedException.class) + @Test public void testFailConvertLocalized() { this.intConverter.setNumberFormat(null); - assertEquals(Integer.valueOf("1234"), this.intConverter.displayToCanonicalValue("1,234")); + assertThrows(ConversionFailedException.class, () -> this.intConverter.displayToCanonicalValue("1,234")); } @Test diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultLongDisplayConverterTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultLongDisplayConverterTest.java index 36b7fd9b..f59e3897 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultLongDisplayConverterTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultLongDisplayConverterTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,12 +12,13 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.data.convert; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.text.NumberFormat; import java.util.Locale; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DefaultLongDisplayConverterTest { @@ -43,9 +44,9 @@ public class DefaultLongDisplayConverterTest { assertEquals(null, this.longConverter.displayToCanonicalValue("")); } - @Test(expected = ConversionFailedException.class) + @Test public void testConversionException() { - this.longConverter.displayToCanonicalValue("abc"); + assertThrows(ConversionFailedException.class, () -> this.longConverter.displayToCanonicalValue("abc")); } @Test @@ -55,10 +56,10 @@ public class DefaultLongDisplayConverterTest { assertEquals("1,234", this.longConverter.canonicalToDisplayValue(Long.valueOf("1234"))); } - @Test(expected = ConversionFailedException.class) + @Test public void testFailConvertLocalized() { this.longConverter.setNumberFormat(null); - assertEquals(Long.valueOf("1234"), this.longConverter.displayToCanonicalValue("1,234")); + assertThrows(ConversionFailedException.class, () -> this.longConverter.displayToCanonicalValue("1,234")); } @Test diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultShortDisplayConverterTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultShortDisplayConverterTest.java index a6bbc8ae..dc93c037 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultShortDisplayConverterTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/DefaultShortDisplayConverterTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,12 +12,13 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.data.convert; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.text.NumberFormat; import java.util.Locale; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DefaultShortDisplayConverterTest { @@ -43,15 +44,15 @@ public class DefaultShortDisplayConverterTest { assertEquals(null, this.shortConverter.displayToCanonicalValue("")); } - @Test(expected = ConversionFailedException.class) + @Test public void testConversionException() { - this.shortConverter.displayToCanonicalValue("abc"); + assertThrows(ConversionFailedException.class, () -> this.shortConverter.displayToCanonicalValue("abc")); } - @Test(expected = ConversionFailedException.class) + @Test public void testConversionExceptionTooBig() { this.shortConverter.setNumberFormat(null); - this.shortConverter.displayToCanonicalValue("32768"); + assertThrows(ConversionFailedException.class, () -> this.shortConverter.displayToCanonicalValue("32768")); } @Test @@ -61,10 +62,10 @@ public class DefaultShortDisplayConverterTest { assertEquals("1,234", this.shortConverter.canonicalToDisplayValue(Short.valueOf("1234"))); } - @Test(expected = ConversionFailedException.class) + @Test public void testFailConvertLocalized() { this.shortConverter.setNumberFormat(null); - assertEquals(Short.valueOf("1234"), this.shortConverter.displayToCanonicalValue("1,234")); + assertThrows(ConversionFailedException.class, () -> this.shortConverter.displayToCanonicalValue("1,234")); } @Test diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/PercentageDisplayConverterTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/PercentageDisplayConverterTest.java index 3b644953..13a47bd3 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/PercentageDisplayConverterTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/convert/PercentageDisplayConverterTest.java @@ -12,13 +12,13 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.data.convert; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PercentageDisplayConverterTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/DataChangeLayerIdIndexTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/DataChangeLayerIdIndexTest.java index 195b7272..aed9cb89 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/DataChangeLayerIdIndexTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/DataChangeLayerIdIndexTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2020 Dirk Fauth. + * Copyright (c) 2017, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,10 +12,10 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.datachange; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.Serializable; import java.util.Collections; @@ -40,8 +40,8 @@ import org.eclipse.nebula.widgets.nattable.layer.event.ColumnInsertEvent; import org.eclipse.nebula.widgets.nattable.layer.event.RowDeleteEvent; import org.eclipse.nebula.widgets.nattable.layer.event.RowInsertEvent; import org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralRefreshEvent; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class DataChangeLayerIdIndexTest { @@ -51,7 +51,7 @@ public class DataChangeLayerIdIndexTest { private DataChangeLayer dataChangeLayer; private PersistenceUpdateDataChangeHandler handler; - @Before + @BeforeEach public void setup() { this.dataModel = PersonService.getFixedPersons(); this.dataProvider = new ListDataProvider<>( @@ -80,7 +80,7 @@ public class DataChangeLayerIdIndexTest { break; } } - assertNotNull("PersistenceUpdateDataChangeHandler not found", this.handler); + assertNotNull(this.handler, "PersistenceUpdateDataChangeHandler not found"); } @Test @@ -91,10 +91,10 @@ public class DataChangeLayerIdIndexTest { assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 1)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(1)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(1), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); } @Test @@ -110,15 +110,15 @@ public class DataChangeLayerIdIndexTest { assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 1)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 1)); - - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); + + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -133,15 +133,15 @@ public class DataChangeLayerIdIndexTest { assertEquals("Simpson", this.dataLayer.getDataValue(1, 1)); assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 1)); - - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); + + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -156,15 +156,15 @@ public class DataChangeLayerIdIndexTest { assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 1)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 1)); - - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); + + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -180,15 +180,15 @@ public class DataChangeLayerIdIndexTest { assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 1)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 1)); - - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); + + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -208,15 +208,15 @@ public class DataChangeLayerIdIndexTest { assertEquals("Simpson", this.dataLayer.getDataValue(1, 2)); assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 2)); assertEquals("Bart", this.dataLayer.getDataValue(0, 2)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(2)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 2)); - - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(2), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 2), "Cell is dirty"); + + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -238,15 +238,15 @@ public class DataChangeLayerIdIndexTest { assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 2)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 2)); assertEquals("Bart", this.dataLayer.getDataValue(0, 2)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(2)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 2)); - - assertFalse("changed columns are empty", this.handler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.handler.changedRows.isEmpty()); - assertFalse("changes are empty", this.handler.dataChanges.isEmpty()); - assertFalse("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(2), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 2), "Cell is not dirty"); + + assertFalse(this.handler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.handler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.handler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -296,50 +296,50 @@ public class DataChangeLayerIdIndexTest { assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 3)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 4)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 0).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 3).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 4).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 5).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 6).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 7).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 11).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 12).hasLabel(DataChangeLayer.DIRTY)); - - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - - assertTrue("Row 0 is not dirty", this.dataChangeLayer.isRowDirty(0)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(1)); - assertTrue("Row 2 is not dirty", this.dataChangeLayer.isRowDirty(2)); - assertTrue("Row 3 is not dirty", this.dataChangeLayer.isRowDirty(3)); - assertTrue("Row 4 is not dirty", this.dataChangeLayer.isRowDirty(4)); - assertFalse("Row 5 is dirty", this.dataChangeLayer.isRowDirty(5)); - assertFalse("Row 6 is dirty", this.dataChangeLayer.isRowDirty(6)); - assertFalse("Row 7 is dirty", this.dataChangeLayer.isRowDirty(7)); - assertFalse("Row 8 is dirty", this.dataChangeLayer.isRowDirty(8)); - assertFalse("Row 9 is dirty", this.dataChangeLayer.isRowDirty(9)); - assertFalse("Row 10 is dirty", this.dataChangeLayer.isRowDirty(10)); - assertFalse("Row 11 is dirty", this.dataChangeLayer.isRowDirty(11)); - assertFalse("Row 12 is dirty", this.dataChangeLayer.isRowDirty(12)); - - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 0)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 2)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 3)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 4)); - - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 5)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(0, 2)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(2, 3)); - - assertFalse("changed columns are empty", this.handler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.handler.changedRows.isEmpty()); - assertFalse("changes are empty", this.handler.dataChanges.isEmpty()); - assertFalse("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 0).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 3).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 4).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 5).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 6).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 7).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 11).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 12).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + + assertTrue(this.dataChangeLayer.isRowDirty(0), "Row 0 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(1), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(2), "Row 2 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(3), "Row 3 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(4), "Row 4 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(5), "Row 5 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(6), "Row 6 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(7), "Row 7 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(8), "Row 8 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(9), "Row 9 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(10), "Row 10 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(11), "Row 11 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(12), "Row 12 is dirty"); + + assertTrue(this.dataChangeLayer.isCellDirty(1, 0), "Cell is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 2), "Cell is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 3), "Cell is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 4), "Cell is not dirty"); + + assertFalse(this.dataChangeLayer.isCellDirty(1, 5), "Cell is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, 2), "Cell is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(2, 3), "Cell is dirty"); + + assertFalse(this.handler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.handler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.handler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -357,19 +357,19 @@ public class DataChangeLayerIdIndexTest { assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 3)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 3)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(2)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 2)); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isRowDirty(2), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 2), "Cell is dirty"); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 3).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(3)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 3)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 3).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(3), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 3), "Cell is not dirty"); - assertFalse("changed columns are empty", this.handler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.handler.changedRows.isEmpty()); - assertFalse("changes are empty", this.handler.dataChanges.isEmpty()); - assertFalse("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.handler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.handler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.handler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -437,59 +437,59 @@ public class DataChangeLayerIdIndexTest { assertEquals("Muntz", this.dataChangeLayer.getDataValueByPosition(1, 13)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 14)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 0).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 3).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 4).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 5).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 6).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 7).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 11).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 12).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 13).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 14).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 15).hasLabel(DataChangeLayer.DIRTY)); - - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - - assertFalse("Row 0 is not dirty", this.dataChangeLayer.isRowDirty(0)); - assertFalse("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(1)); - assertTrue("Row 2 is not dirty", this.dataChangeLayer.isRowDirty(2)); - assertFalse("Row 3 is not dirty", this.dataChangeLayer.isRowDirty(3)); - assertFalse("Row 4 is not dirty", this.dataChangeLayer.isRowDirty(4)); - assertTrue("Row 5 is not dirty", this.dataChangeLayer.isRowDirty(5)); - assertFalse("Row 6 is not dirty", this.dataChangeLayer.isRowDirty(6)); - assertFalse("Row 7 is not dirty", this.dataChangeLayer.isRowDirty(7)); - assertTrue("Row 8 is not dirty", this.dataChangeLayer.isRowDirty(8)); - assertFalse("Row 9 is not dirty", this.dataChangeLayer.isRowDirty(9)); - assertFalse("Row 10 is not dirty", this.dataChangeLayer.isRowDirty(10)); - assertTrue("Row 11 is not dirty", this.dataChangeLayer.isRowDirty(11)); - assertFalse("Row 12 is not dirty", this.dataChangeLayer.isRowDirty(12)); - assertFalse("Row 13 is not dirty", this.dataChangeLayer.isRowDirty(13)); - assertTrue("Row 14 is not dirty", this.dataChangeLayer.isRowDirty(14)); - assertFalse("Row 15 is not dirty", this.dataChangeLayer.isRowDirty(15)); - assertFalse("Row 16 is not dirty", this.dataChangeLayer.isRowDirty(16)); - assertFalse("Row 17 is not dirty", this.dataChangeLayer.isRowDirty(17)); - assertFalse("Row 18 is not dirty", this.dataChangeLayer.isRowDirty(18)); - - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 2)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 5)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 8)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 11)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 14)); - - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 4)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(0, 2)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(2, 3)); - - assertFalse("changed columns are empty", this.handler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.handler.changedRows.isEmpty()); - assertFalse("changes are empty", this.handler.dataChanges.isEmpty()); - assertFalse("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 0).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 3).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 4).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 5).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 6).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 7).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 11).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 12).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 13).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 14).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 15).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + + assertFalse(this.dataChangeLayer.isRowDirty(0), "Row 0 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(2), "Row 2 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(3), "Row 3 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(4), "Row 4 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(5), "Row 5 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(6), "Row 6 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(7), "Row 7 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(8), "Row 8 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(9), "Row 9 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(10), "Row 10 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(11), "Row 11 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(12), "Row 12 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(13), "Row 13 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(14), "Row 14 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(15), "Row 15 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(16), "Row 16 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(17), "Row 17 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(18), "Row 18 is not dirty"); + + assertTrue(this.dataChangeLayer.isCellDirty(1, 2), "Cell is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 5), "Cell is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 8), "Cell is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 11), "Cell is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 14), "Cell is not dirty"); + + assertFalse(this.dataChangeLayer.isCellDirty(1, 4), "Cell is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, 2), "Cell is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(2, 3), "Cell is dirty"); + + assertFalse(this.handler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.handler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.handler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -503,15 +503,15 @@ public class DataChangeLayerIdIndexTest { // simulate column deletion this.dataLayer.fireLayerEvent(new ColumnDeleteEvent(this.dataLayer, 0)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 2 is dirty", this.dataChangeLayer.isRowDirty(2)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 2)); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(2), "Row 2 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 2), "Cell is dirty"); - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -525,17 +525,17 @@ public class DataChangeLayerIdIndexTest { // simulate column deletion this.dataLayer.fireLayerEvent(new ColumnDeleteEvent(this.dataLayer, 0)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(0, 2).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Column 0 is not dirty", this.dataChangeLayer.isColumnDirty(0)); - assertTrue("Row 2 is not dirty", this.dataChangeLayer.isRowDirty(2)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(0, 2)); - - assertFalse("changed columns are empty", this.handler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.handler.changedRows.isEmpty()); - assertFalse("changes are empty", this.handler.dataChanges.isEmpty()); - assertFalse("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(0, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(0), "Column 0 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(2), "Row 2 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(0, 2), "Cell is not dirty"); + + assertFalse(this.handler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.handler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.handler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -549,17 +549,17 @@ public class DataChangeLayerIdIndexTest { // simulate column deletion this.dataLayer.fireLayerEvent(new ColumnInsertEvent(this.dataLayer, 0)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(2, 2).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Column 2 is not dirty", this.dataChangeLayer.isColumnDirty(2)); - assertTrue("Row 2 is not dirty", this.dataChangeLayer.isRowDirty(2)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(2, 2)); - - assertFalse("changed columns are empty", this.handler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.handler.changedRows.isEmpty()); - assertFalse("changes are empty", this.handler.dataChanges.isEmpty()); - assertFalse("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(2, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(2), "Column 2 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(2), "Row 2 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(2, 2), "Cell is not dirty"); + + assertFalse(this.handler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.handler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.handler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -579,34 +579,34 @@ public class DataChangeLayerIdIndexTest { assertEquals("Zoolander", this.dataLayer.getDataValue(1, 17)); assertEquals("Zoolander", this.dataChangeLayer.getDataValueByPosition(1, 17)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 17).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 2 is dirty", this.dataChangeLayer.isRowDirty(2)); - assertTrue("Row 17 is not dirty", this.dataChangeLayer.isRowDirty(17)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 17)); - - assertFalse("changed columns are empty", this.handler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.handler.changedRows.isEmpty()); - assertFalse("changes are empty", this.handler.dataChanges.isEmpty()); - assertFalse("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 17).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(2), "Row 2 is dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(17), "Row 17 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 17), "Cell is not dirty"); + + assertFalse(this.handler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.handler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.handler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); // check if discard is applied correctly this.dataChangeLayer.doCommand(new DiscardDataChangesCommand()); assertEquals("Simpson", this.dataLayer.getDataValue(1, 17)); assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 17)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 17).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 2 is dirty", this.dataChangeLayer.isRowDirty(2)); - assertFalse("Row 17 is dirty", this.dataChangeLayer.isRowDirty(17)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 17)); - - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 17).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(2), "Row 2 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(17), "Row 17 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 17), "Cell is dirty"); + + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -631,7 +631,7 @@ public class DataChangeLayerIdIndexTest { break; } } - assertNotNull("TemporaryUpdateDataChangeHandler not found", tempHandler); + assertNotNull(tempHandler, "TemporaryUpdateDataChangeHandler not found"); assertEquals("Simpson", this.dataLayer.getDataValue(1, 2)); @@ -652,34 +652,34 @@ public class DataChangeLayerIdIndexTest { assertEquals("Simpson", this.dataLayer.getDataValue(1, 17)); assertEquals("Zoolander", this.dataChangeLayer.getDataValueByPosition(1, 17)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 17).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 2 is dirty", this.dataChangeLayer.isRowDirty(2)); - assertTrue("Row 17 is not dirty", this.dataChangeLayer.isRowDirty(17)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 17)); - - assertFalse("changed columns are empty", tempHandler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", tempHandler.changedRows.isEmpty()); - assertFalse("changes are empty", tempHandler.dataChanges.isEmpty()); - assertFalse("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 17).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(2), "Row 2 is dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(17), "Row 17 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 17), "Cell is not dirty"); + + assertFalse(tempHandler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(tempHandler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(tempHandler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); // check if discard is applied correctly this.dataChangeLayer.doCommand(new SaveDataChangesCommand()); assertEquals("Zoolander", this.dataLayer.getDataValue(1, 17)); assertEquals("Zoolander", this.dataChangeLayer.getDataValueByPosition(1, 17)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 17).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 2 is dirty", this.dataChangeLayer.isRowDirty(2)); - assertFalse("Row 17 is dirty", this.dataChangeLayer.isRowDirty(17)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 17)); - - assertTrue("changed columns are not empty", tempHandler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", tempHandler.changedRows.isEmpty()); - assertTrue("changes are not empty", tempHandler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 17).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(2), "Row 2 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(17), "Row 17 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 17), "Cell is dirty"); + + assertTrue(tempHandler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(tempHandler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(tempHandler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -690,10 +690,10 @@ public class DataChangeLayerIdIndexTest { assertEquals("Simpson", this.dataLayer.getDataValue(1, 1)); assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); assertEquals(0, this.dataChangeLayer.dataChanges.size()); } @@ -705,20 +705,20 @@ public class DataChangeLayerIdIndexTest { assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 1)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(1)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(1), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); assertEquals(1, this.dataChangeLayer.dataChanges.size()); this.dataChangeLayer.doCommand(new UpdateDataCommand(this.dataChangeLayer, 1, 1, "Simpson")); assertEquals("Simpson", this.dataLayer.getDataValue(1, 1)); assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); assertEquals(2, this.dataChangeLayer.dataChanges.size()); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/DataChangeLayerTempStorageTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/DataChangeLayerTempStorageTest.java index eda7d80f..1ffe80b0 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/DataChangeLayerTempStorageTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/DataChangeLayerTempStorageTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2020 Dirk Fauth. + * Copyright (c) 2017, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,11 +12,11 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.datachange; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Date; import java.util.List; @@ -38,8 +38,8 @@ import org.eclipse.nebula.widgets.nattable.layer.event.CellVisualChangeEvent; import org.eclipse.nebula.widgets.nattable.layer.event.RowDeleteEvent; import org.eclipse.nebula.widgets.nattable.layer.event.RowInsertEvent; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class DataChangeLayerTempStorageTest { @@ -49,7 +49,7 @@ public class DataChangeLayerTempStorageTest { private DataChangeLayer dataChangeLayer; private TemporaryUpdateDataChangeHandler handler; - @Before + @BeforeEach public void setup() { this.dataModel = PersonService.getFixedPersons(); this.dataLayer = new DataLayer( @@ -68,7 +68,7 @@ public class DataChangeLayerTempStorageTest { break; } } - assertNotNull("PersistenceUpdateDataChangeHandler not found", this.handler); + assertNotNull(this.handler, "PersistenceUpdateDataChangeHandler not found"); } @Test @@ -79,10 +79,10 @@ public class DataChangeLayerTempStorageTest { assertEquals("Simpson", this.dataLayer.getDataValue(1, 1)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(1)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(1), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); } @Test @@ -99,15 +99,15 @@ public class DataChangeLayerTempStorageTest { assertEquals("Simpson", this.dataLayer.getDataValue(1, 1)); assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); - - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is not dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); + + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -126,15 +126,15 @@ public class DataChangeLayerTempStorageTest { assertEquals("Simpson", this.dataLayer.getDataValue(1, 1)); assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is not dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); // initial CellVisualChangeEvent // final DiscardDataChangesCompletedEvent @@ -160,15 +160,15 @@ public class DataChangeLayerTempStorageTest { assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 1)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is not dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); // initial CellVisualChangeEvent // update DataUpdateEvent @@ -194,15 +194,15 @@ public class DataChangeLayerTempStorageTest { assertEquals("Simpson", this.dataLayer.getDataValue(1, 1)); assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); - - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is not dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); + + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -224,15 +224,15 @@ public class DataChangeLayerTempStorageTest { assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 8)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 9)); assertEquals("Flanders", this.dataChangeLayer.getDataValueByPosition(1, 9)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(8)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 8)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(8), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 8), "Cell is not dirty"); - assertFalse("changed columns are empty", this.handler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.handler.changedRows.isEmpty()); - assertFalse("changes are empty", this.handler.dataChanges.isEmpty()); - assertFalse("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.handler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.handler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.handler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); // now discard and check that previous state is restored correctly this.dataChangeLayer.doCommand(new DiscardDataChangesCommand()); @@ -241,15 +241,15 @@ public class DataChangeLayerTempStorageTest { assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 8)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 9)); assertEquals("Flanders", this.dataChangeLayer.getDataValueByPosition(1, 9)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(8)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 8)); - - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(8), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 8), "Cell is dirty"); + + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -271,15 +271,15 @@ public class DataChangeLayerTempStorageTest { assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 8)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 9)); assertEquals("Flanders", this.dataChangeLayer.getDataValueByPosition(1, 9)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(8)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 8)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(8), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 8), "Cell is not dirty"); - assertFalse("changed columns are empty", this.handler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.handler.changedRows.isEmpty()); - assertFalse("changes are empty", this.handler.dataChanges.isEmpty()); - assertFalse("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.handler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.handler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.handler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); // now discard and check that previous state is restored correctly this.dataChangeLayer.doCommand(new SaveDataChangesCommand()); @@ -288,15 +288,15 @@ public class DataChangeLayerTempStorageTest { assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 8)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 9)); assertEquals("Flanders", this.dataChangeLayer.getDataValueByPosition(1, 9)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(8)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 8)); - - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(8), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 8), "Cell is dirty"); + + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -318,15 +318,15 @@ public class DataChangeLayerTempStorageTest { assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 10)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 11)); assertEquals("Flanders", this.dataChangeLayer.getDataValueByPosition(1, 11)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(10)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 10)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(10), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 10), "Cell is not dirty"); - assertFalse("changed columns are empty", this.handler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.handler.changedRows.isEmpty()); - assertFalse("changes are empty", this.handler.dataChanges.isEmpty()); - assertFalse("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.handler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.handler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.handler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); // now discard and check that previous state is restored correctly this.dataChangeLayer.doCommand(new SaveDataChangesCommand()); @@ -335,15 +335,15 @@ public class DataChangeLayerTempStorageTest { assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 10)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 11)); assertEquals("Flanders", this.dataChangeLayer.getDataValueByPosition(1, 11)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(10)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 10)); - - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(10), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 10), "Cell is dirty"); + + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -354,10 +354,10 @@ public class DataChangeLayerTempStorageTest { assertEquals("Simpson", this.dataLayer.getDataValue(1, 1)); assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); } @Test @@ -368,19 +368,19 @@ public class DataChangeLayerTempStorageTest { assertEquals("Simpson", this.dataLayer.getDataValue(1, 1)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(1)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(1), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); this.dataChangeLayer.doCommand(new UpdateDataCommand(this.dataChangeLayer, 1, 1, "Simpson")); assertEquals("Simpson", this.dataLayer.getDataValue(1, 1)); assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); } @Test @@ -391,19 +391,19 @@ public class DataChangeLayerTempStorageTest { assertEquals("Simpson", this.dataLayer.getDataValue(1, 1)); assertEquals(null, this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(1)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(1), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); this.dataChangeLayer.doCommand(new UpdateDataCommand(this.dataChangeLayer, 1, 1, "Simpson")); assertEquals("Simpson", this.dataLayer.getDataValue(1, 1)); assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); } @Test @@ -416,19 +416,19 @@ public class DataChangeLayerTempStorageTest { assertNull(this.dataLayer.getDataValue(1, 1)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(1)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(1), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); this.dataChangeLayer.doCommand(new UpdateDataCommand(this.dataChangeLayer, 1, 1, null)); assertNull(this.dataLayer.getDataValue(1, 1)); assertNull(this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); } @Test @@ -441,9 +441,9 @@ public class DataChangeLayerTempStorageTest { assertNull(this.dataLayer.getDataValue(1, 1)); assertNull(this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/DataChangeLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/DataChangeLayerTest.java index ad227406..d5e86b6d 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/DataChangeLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/DataChangeLayerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2020 Dirk Fauth. + * Copyright (c) 2017, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,11 +12,11 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.datachange; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Date; import java.util.List; @@ -40,8 +40,8 @@ import org.eclipse.nebula.widgets.nattable.layer.event.ColumnInsertEvent; import org.eclipse.nebula.widgets.nattable.layer.event.RowDeleteEvent; import org.eclipse.nebula.widgets.nattable.layer.event.RowInsertEvent; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class DataChangeLayerTest { @@ -51,7 +51,7 @@ public class DataChangeLayerTest { private DataChangeLayer dataChangeLayer; private PersistenceUpdateDataChangeHandler handler; - @Before + @BeforeEach public void setup() { this.dataModel = PersonService.getFixedPersons(); this.dataLayer = new DataLayer( @@ -70,7 +70,7 @@ public class DataChangeLayerTest { break; } } - assertNotNull("PersistenceUpdateDataChangeHandler not found", this.handler); + assertNotNull(this.handler, "PersistenceUpdateDataChangeHandler not found"); } @Test @@ -81,10 +81,10 @@ public class DataChangeLayerTest { assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 1)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(1)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(1), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); } @Test @@ -100,15 +100,15 @@ public class DataChangeLayerTest { assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 1)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 1)); - - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); + + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -126,15 +126,15 @@ public class DataChangeLayerTest { assertEquals("Simpson", this.dataLayer.getDataValue(1, 1)); assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); // initial DataUpdateEvent // discard DataUpdateEvent @@ -160,15 +160,15 @@ public class DataChangeLayerTest { assertEquals("Simpson", this.dataLayer.getDataValue(1, 1)); assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 1)); - - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); + + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -186,15 +186,15 @@ public class DataChangeLayerTest { assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 1)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); // initial DataUpdateEvent // final SaveDataChangesCompletedEvent @@ -217,15 +217,15 @@ public class DataChangeLayerTest { assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 1)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 1)); - - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); + + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -245,15 +245,15 @@ public class DataChangeLayerTest { assertEquals("Simpson", this.dataLayer.getDataValue(1, 2)); assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 2)); assertEquals("Bart", this.dataLayer.getDataValue(0, 2)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(2)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 2)); - - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(2), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 2), "Cell is dirty"); + + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -275,15 +275,15 @@ public class DataChangeLayerTest { assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 2)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 2)); assertEquals("Bart", this.dataLayer.getDataValue(0, 2)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(2)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 2)); - - assertFalse("changed columns are empty", this.handler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.handler.changedRows.isEmpty()); - assertFalse("changes are empty", this.handler.dataChanges.isEmpty()); - assertFalse("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(2), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 2), "Cell is not dirty"); + + assertFalse(this.handler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.handler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.handler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -333,50 +333,50 @@ public class DataChangeLayerTest { assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 3)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 4)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 0).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 3).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 4).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 5).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 6).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 7).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 11).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 12).hasLabel(DataChangeLayer.DIRTY)); - - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - - assertTrue("Row 0 is not dirty", this.dataChangeLayer.isRowDirty(0)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(1)); - assertTrue("Row 2 is not dirty", this.dataChangeLayer.isRowDirty(2)); - assertTrue("Row 3 is not dirty", this.dataChangeLayer.isRowDirty(3)); - assertTrue("Row 4 is not dirty", this.dataChangeLayer.isRowDirty(4)); - assertFalse("Row 5 is dirty", this.dataChangeLayer.isRowDirty(5)); - assertFalse("Row 6 is dirty", this.dataChangeLayer.isRowDirty(6)); - assertFalse("Row 7 is dirty", this.dataChangeLayer.isRowDirty(7)); - assertFalse("Row 8 is dirty", this.dataChangeLayer.isRowDirty(8)); - assertFalse("Row 9 is dirty", this.dataChangeLayer.isRowDirty(9)); - assertFalse("Row 10 is dirty", this.dataChangeLayer.isRowDirty(10)); - assertFalse("Row 11 is dirty", this.dataChangeLayer.isRowDirty(11)); - assertFalse("Row 12 is dirty", this.dataChangeLayer.isRowDirty(12)); - - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 0)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 2)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 3)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 4)); - - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 5)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(0, 2)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(2, 3)); - - assertFalse("changed columns are empty", this.handler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.handler.changedRows.isEmpty()); - assertFalse("changes are empty", this.handler.dataChanges.isEmpty()); - assertFalse("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 0).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 3).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 4).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 5).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 6).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 7).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 11).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 12).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + + assertTrue(this.dataChangeLayer.isRowDirty(0), "Row 0 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(1), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(2), "Row 2 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(3), "Row 3 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(4), "Row 4 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(5), "Row 5 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(6), "Row 6 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(7), "Row 7 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(8), "Row 8 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(9), "Row 9 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(10), "Row 10 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(11), "Row 11 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(12), "Row 12 is dirty"); + + assertTrue(this.dataChangeLayer.isCellDirty(1, 0), "Cell is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 2), "Cell is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 3), "Cell is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 4), "Cell is not dirty"); + + assertFalse(this.dataChangeLayer.isCellDirty(1, 5), "Cell is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, 2), "Cell is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(2, 3), "Cell is dirty"); + + assertFalse(this.handler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.handler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.handler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -394,19 +394,19 @@ public class DataChangeLayerTest { assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 3)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 3)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(2)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 2)); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isRowDirty(2), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 2), "Cell is dirty"); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 3).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(3)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 3)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 3).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(3), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 3), "Cell is not dirty"); - assertFalse("changed columns are empty", this.handler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.handler.changedRows.isEmpty()); - assertFalse("changes are empty", this.handler.dataChanges.isEmpty()); - assertFalse("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.handler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.handler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.handler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -474,59 +474,59 @@ public class DataChangeLayerTest { assertEquals("Muntz", this.dataChangeLayer.getDataValueByPosition(1, 13)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 14)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 0).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 3).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 4).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 5).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 6).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 7).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 11).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 12).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 13).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 14).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 15).hasLabel(DataChangeLayer.DIRTY)); - - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - - assertFalse("Row 0 is not dirty", this.dataChangeLayer.isRowDirty(0)); - assertFalse("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(1)); - assertTrue("Row 2 is not dirty", this.dataChangeLayer.isRowDirty(2)); - assertFalse("Row 3 is not dirty", this.dataChangeLayer.isRowDirty(3)); - assertFalse("Row 4 is not dirty", this.dataChangeLayer.isRowDirty(4)); - assertTrue("Row 5 is not dirty", this.dataChangeLayer.isRowDirty(5)); - assertFalse("Row 6 is not dirty", this.dataChangeLayer.isRowDirty(6)); - assertFalse("Row 7 is not dirty", this.dataChangeLayer.isRowDirty(7)); - assertTrue("Row 8 is not dirty", this.dataChangeLayer.isRowDirty(8)); - assertFalse("Row 9 is not dirty", this.dataChangeLayer.isRowDirty(9)); - assertFalse("Row 10 is not dirty", this.dataChangeLayer.isRowDirty(10)); - assertTrue("Row 11 is not dirty", this.dataChangeLayer.isRowDirty(11)); - assertFalse("Row 12 is not dirty", this.dataChangeLayer.isRowDirty(12)); - assertFalse("Row 13 is not dirty", this.dataChangeLayer.isRowDirty(13)); - assertTrue("Row 14 is not dirty", this.dataChangeLayer.isRowDirty(14)); - assertFalse("Row 15 is not dirty", this.dataChangeLayer.isRowDirty(15)); - assertFalse("Row 16 is not dirty", this.dataChangeLayer.isRowDirty(16)); - assertFalse("Row 17 is not dirty", this.dataChangeLayer.isRowDirty(17)); - assertFalse("Row 18 is not dirty", this.dataChangeLayer.isRowDirty(18)); - - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 2)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 5)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 8)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 11)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 14)); - - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 4)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(0, 2)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(2, 3)); - - assertFalse("changed columns are empty", this.handler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.handler.changedRows.isEmpty()); - assertFalse("changes are empty", this.handler.dataChanges.isEmpty()); - assertFalse("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 0).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 3).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 4).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 5).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 6).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 7).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 11).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 12).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 13).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 14).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 15).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + + assertFalse(this.dataChangeLayer.isRowDirty(0), "Row 0 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(2), "Row 2 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(3), "Row 3 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(4), "Row 4 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(5), "Row 5 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(6), "Row 6 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(7), "Row 7 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(8), "Row 8 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(9), "Row 9 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(10), "Row 10 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(11), "Row 11 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(12), "Row 12 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(13), "Row 13 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(14), "Row 14 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(15), "Row 15 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(16), "Row 16 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(17), "Row 17 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(18), "Row 18 is not dirty"); + + assertTrue(this.dataChangeLayer.isCellDirty(1, 2), "Cell is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 5), "Cell is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 8), "Cell is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 11), "Cell is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 14), "Cell is not dirty"); + + assertFalse(this.dataChangeLayer.isCellDirty(1, 4), "Cell is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, 2), "Cell is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(2, 3), "Cell is dirty"); + + assertFalse(this.handler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.handler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.handler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -540,15 +540,15 @@ public class DataChangeLayerTest { // simulate column deletion this.dataLayer.fireLayerEvent(new ColumnDeleteEvent(this.dataLayer, 0)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 2 is dirty", this.dataChangeLayer.isRowDirty(2)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 2)); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(2), "Row 2 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 2), "Cell is dirty"); - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -562,17 +562,17 @@ public class DataChangeLayerTest { // simulate column deletion this.dataLayer.fireLayerEvent(new ColumnDeleteEvent(this.dataLayer, 0)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(0, 2).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Column 0 is not dirty", this.dataChangeLayer.isColumnDirty(0)); - assertTrue("Row 2 is not dirty", this.dataChangeLayer.isRowDirty(2)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(0, 2)); - - assertFalse("changed columns are empty", this.handler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.handler.changedRows.isEmpty()); - assertFalse("changes are empty", this.handler.dataChanges.isEmpty()); - assertFalse("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(0, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(0), "Column 0 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(2), "Row 2 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(0, 2), "Cell is not dirty"); + + assertFalse(this.handler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.handler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.handler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -586,17 +586,17 @@ public class DataChangeLayerTest { // simulate column deletion this.dataLayer.fireLayerEvent(new ColumnInsertEvent(this.dataLayer, 0)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(2, 2).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Column 2 is not dirty", this.dataChangeLayer.isColumnDirty(2)); - assertTrue("Row 2 is not dirty", this.dataChangeLayer.isRowDirty(2)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(2, 2)); - - assertFalse("changed columns are empty", this.handler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.handler.changedRows.isEmpty()); - assertFalse("changes are empty", this.handler.dataChanges.isEmpty()); - assertFalse("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(2, 2).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(2), "Column 2 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(2), "Row 2 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(2, 2), "Cell is not dirty"); + + assertFalse(this.handler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.handler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.handler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -617,15 +617,15 @@ public class DataChangeLayerTest { assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 8)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 9)); assertEquals("Flanders", this.dataChangeLayer.getDataValueByPosition(1, 9)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(8)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 8)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(8), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 8), "Cell is not dirty"); - assertFalse("changed columns are empty", this.handler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.handler.changedRows.isEmpty()); - assertFalse("changes are empty", this.handler.dataChanges.isEmpty()); - assertFalse("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.handler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.handler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.handler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); // now discard and check that previous state is restored correctly this.dataChangeLayer.doCommand(new DiscardDataChangesCommand()); @@ -634,15 +634,15 @@ public class DataChangeLayerTest { assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 8)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 9)); assertEquals("Flanders", this.dataChangeLayer.getDataValueByPosition(1, 9)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(8)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 8)); - - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(8), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 8), "Cell is dirty"); + + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -663,15 +663,15 @@ public class DataChangeLayerTest { assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 8)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 9)); assertEquals("Flanders", this.dataChangeLayer.getDataValueByPosition(1, 9)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(8)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 8)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(8), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 8), "Cell is not dirty"); - assertFalse("changed columns are empty", this.handler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.handler.changedRows.isEmpty()); - assertFalse("changes are empty", this.handler.dataChanges.isEmpty()); - assertFalse("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.handler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.handler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.handler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); // now discard and check that previous state is restored correctly this.dataChangeLayer.doCommand(new SaveDataChangesCommand()); @@ -680,15 +680,15 @@ public class DataChangeLayerTest { assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 8)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 9)); assertEquals("Flanders", this.dataChangeLayer.getDataValueByPosition(1, 9)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(8)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 8)); - - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(8), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 8), "Cell is dirty"); + + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -699,10 +699,10 @@ public class DataChangeLayerTest { assertEquals("Simpson", this.dataLayer.getDataValue(1, 1)); assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); assertEquals(0, this.dataChangeLayer.dataChanges.size()); } @@ -714,20 +714,20 @@ public class DataChangeLayerTest { assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 1)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(1)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(1), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); assertEquals(1, this.dataChangeLayer.dataChanges.size()); this.dataChangeLayer.doCommand(new UpdateDataCommand(this.dataChangeLayer, 1, 1, "Simpson")); assertEquals("Simpson", this.dataLayer.getDataValue(1, 1)); assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); assertEquals(2, this.dataChangeLayer.dataChanges.size()); } @@ -739,19 +739,19 @@ public class DataChangeLayerTest { assertEquals(null, this.dataLayer.getDataValue(1, 1)); assertEquals(null, this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(1)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(1), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); this.dataChangeLayer.doCommand(new UpdateDataCommand(this.dataChangeLayer, 1, 1, "Simpson")); assertEquals("Simpson", this.dataLayer.getDataValue(1, 1)); assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); } @Test @@ -764,19 +764,19 @@ public class DataChangeLayerTest { assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 1)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(1)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(1), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); this.dataChangeLayer.doCommand(new UpdateDataCommand(this.dataChangeLayer, 1, 1, null)); assertNull(this.dataLayer.getDataValue(1, 1)); assertNull(this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); } @Test @@ -789,10 +789,10 @@ public class DataChangeLayerTest { assertNull(this.dataLayer.getDataValue(1, 1)); assertNull(this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(1)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(1), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); } @Test @@ -813,15 +813,15 @@ public class DataChangeLayerTest { assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 10)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 11)); assertEquals("Flanders", this.dataChangeLayer.getDataValueByPosition(1, 11)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(10)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 10)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(10), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 10), "Cell is not dirty"); - assertFalse("changed columns are empty", this.handler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.handler.changedRows.isEmpty()); - assertFalse("changes are empty", this.handler.dataChanges.isEmpty()); - assertFalse("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.handler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.handler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.handler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); // now discard and check that previous state is restored correctly this.dataChangeLayer.doCommand(new DiscardDataChangesCommand()); @@ -830,14 +830,14 @@ public class DataChangeLayerTest { assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 10)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 11)); assertEquals("Flanders", this.dataChangeLayer.getDataValueByPosition(1, 11)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 1 is dirty", this.dataChangeLayer.isRowDirty(10)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 10)); - - assertTrue("changed columns are not empty", this.handler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.handler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.handler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(10), "Row 1 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 10), "Cell is dirty"); + + assertTrue(this.handler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.handler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.handler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/RowStructuralDataChangeIdIndexTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/RowStructuralDataChangeIdIndexTest.java index 5a296fc1..867e3f6f 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/RowStructuralDataChangeIdIndexTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/RowStructuralDataChangeIdIndexTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2020 Dirk Fauth. + * Copyright (c) 2018, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,10 +12,10 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.datachange; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.Serializable; import java.util.Date; @@ -36,8 +36,8 @@ import org.eclipse.nebula.widgets.nattable.dataset.person.Person.Gender; import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService; import org.eclipse.nebula.widgets.nattable.edit.command.UpdateDataCommand; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; @SuppressWarnings("unchecked") public class RowStructuralDataChangeIdIndexTest { @@ -50,7 +50,7 @@ public class RowStructuralDataChangeIdIndexTest { private RowInsertDataChangeHandler insertHandler; private RowDeleteDataChangeHandler deleteHandler; - @Before + @BeforeEach public void setup() { this.dataModel = PersonService.getFixedPersons(); this.dataProvider = new ListDataProvider<>( @@ -92,9 +92,9 @@ public class RowStructuralDataChangeIdIndexTest { this.updateHandler = (PersistenceUpdateDataChangeHandler) h; } } - assertNotNull("RowInsertDataChangeHandler not found", this.insertHandler); - assertNotNull("RowDeleteDataChangeHandler not found", this.deleteHandler); - assertNotNull("PersistenceUpdateDataChangeHandler not found", this.updateHandler); + assertNotNull(this.insertHandler, "RowInsertDataChangeHandler not found"); + assertNotNull(this.deleteHandler, "RowDeleteDataChangeHandler not found"); + assertNotNull(this.updateHandler, "PersistenceUpdateDataChangeHandler not found"); } @Test @@ -108,25 +108,25 @@ public class RowStructuralDataChangeIdIndexTest { assertEquals(19, this.dataModel.size()); // row added so all columns are actually dirty - assertTrue("Column 0 is not dirty", this.dataChangeLayer.isColumnDirty(0)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Column 2 is not dirty", this.dataChangeLayer.isColumnDirty(2)); - assertTrue("Column 3 is not dirty", this.dataChangeLayer.isColumnDirty(3)); - assertTrue("Column 4 is not dirty", this.dataChangeLayer.isColumnDirty(4)); - - assertTrue("Row " + ralphIndex + " is not dirty", this.dataChangeLayer.isRowDirty(ralphIndex)); - - assertTrue("Cell 0/" + ralphIndex + " is not dirty", this.dataChangeLayer.isCellDirty(0, ralphIndex)); - assertTrue("Cell 1/" + ralphIndex + " is not dirty", this.dataChangeLayer.isCellDirty(1, ralphIndex)); - assertTrue("Cell 2/" + ralphIndex + " is not dirty", this.dataChangeLayer.isCellDirty(2, ralphIndex)); - assertTrue("Cell 3/" + ralphIndex + " is not dirty", this.dataChangeLayer.isCellDirty(3, ralphIndex)); - assertTrue("Cell 4/" + ralphIndex + " is not dirty", this.dataChangeLayer.isCellDirty(4, ralphIndex)); - - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(2, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(3, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(4, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); + assertTrue(this.dataChangeLayer.isColumnDirty(0), "Column 0 is not dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(2), "Column 2 is not dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(3), "Column 3 is not dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(4), "Column 4 is not dirty"); + + assertTrue(this.dataChangeLayer.isRowDirty(ralphIndex), "Row " + ralphIndex + " is not dirty"); + + assertTrue(this.dataChangeLayer.isCellDirty(0, ralphIndex), "Cell 0/" + ralphIndex + " is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, ralphIndex), "Cell 1/" + ralphIndex + " is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(2, ralphIndex), "Cell 2/" + ralphIndex + " is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(3, ralphIndex), "Cell 3/" + ralphIndex + " is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(4, ralphIndex), "Cell 4/" + ralphIndex + " is not dirty"); + + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(2, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(3, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(4, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); assertEquals(1, this.dataChangeLayer.dataChanges.size()); assertEquals(1, this.insertHandler.dataChanges.size()); @@ -150,10 +150,10 @@ public class RowStructuralDataChangeIdIndexTest { assertEquals(1, this.dataChangeLayer.dataChanges.size()); assertEquals(1, this.insertHandler.dataChanges.size()); - assertTrue("Column 0 is not dirty", this.dataChangeLayer.isColumnDirty(0)); - assertTrue("Row " + ralphIndex + " is not dirty", this.dataChangeLayer.isRowDirty(ralphIndex)); - assertTrue("Cell 0/" + ralphIndex + " is not dirty", this.dataChangeLayer.isCellDirty(0, ralphIndex)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); + assertTrue(this.dataChangeLayer.isColumnDirty(0), "Column 0 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(ralphIndex), "Row " + ralphIndex + " is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(0, ralphIndex), "Cell 0/" + ralphIndex + " is not dirty"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); IdIndexIdentifier<Person> identifier = (IdIndexIdentifier<Person>) this.insertHandler.dataChanges.get(key).getKey(); assertEquals(ralph, identifier.rowObject); @@ -168,10 +168,10 @@ public class RowStructuralDataChangeIdIndexTest { assertTrue(this.dataChangeLayer.dataChanges.isEmpty()); assertTrue(this.insertHandler.dataChanges.isEmpty()); - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row " + ralphIndex + " is dirty", this.dataChangeLayer.isRowDirty(ralphIndex)); - assertFalse("Cell 0/" + ralphIndex + " is dirty", this.dataChangeLayer.isCellDirty(0, ralphIndex)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(ralphIndex), "Row " + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, ralphIndex), "Cell 0/" + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); } @Test @@ -195,10 +195,10 @@ public class RowStructuralDataChangeIdIndexTest { assertTrue(this.dataChangeLayer.dataChanges.isEmpty()); assertTrue(this.insertHandler.dataChanges.isEmpty()); - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row " + ralphIndex + " is dirty", this.dataChangeLayer.isRowDirty(ralphIndex)); - assertFalse("Cell 0/" + ralphIndex + " is dirty", this.dataChangeLayer.isCellDirty(0, ralphIndex)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(ralphIndex), "Row " + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, ralphIndex), "Cell 0/" + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); } @Test @@ -226,10 +226,10 @@ public class RowStructuralDataChangeIdIndexTest { assertTrue(this.dataChangeLayer.dataChanges.isEmpty()); assertTrue(this.insertHandler.dataChanges.isEmpty()); - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row " + ralphIndex + " is dirty", this.dataChangeLayer.isRowDirty(ralphIndex)); - assertFalse("Cell 0/" + ralphIndex + " is dirty", this.dataChangeLayer.isCellDirty(0, ralphIndex)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(ralphIndex), "Row " + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, ralphIndex), "Cell 0/" + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); } @Test @@ -249,10 +249,10 @@ public class RowStructuralDataChangeIdIndexTest { assertTrue(this.dataChangeLayer.dataChanges.isEmpty()); assertTrue(this.insertHandler.dataChanges.isEmpty()); - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row " + ralphIndex + " is dirty", this.dataChangeLayer.isRowDirty(ralphIndex)); - assertFalse("Cell 0/" + ralphIndex + " is dirty", this.dataChangeLayer.isCellDirty(0, ralphIndex)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(ralphIndex), "Row " + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, ralphIndex), "Cell 0/" + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); } @Test @@ -287,10 +287,10 @@ public class RowStructuralDataChangeIdIndexTest { assertTrue(this.dataChangeLayer.dataChanges.isEmpty()); assertTrue(this.insertHandler.dataChanges.isEmpty()); - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row " + ralphIndex + " is dirty", this.dataChangeLayer.isRowDirty(ralphIndex)); - assertFalse("Cell 0/" + ralphIndex + " is dirty", this.dataChangeLayer.isCellDirty(0, ralphIndex)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(ralphIndex), "Row " + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, ralphIndex), "Cell 0/" + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); } @Test @@ -319,21 +319,21 @@ public class RowStructuralDataChangeIdIndexTest { assertEquals(18, this.dataModel.size()); for (Person p : this.dataModel) { - assertFalse("Wiggum found", "Wiggum".equals(p.getLastName())); + assertFalse("Wiggum".equals(p.getLastName()), "Wiggum found"); } assertTrue(this.dataChangeLayer.dataChanges.isEmpty()); assertTrue(this.insertHandler.dataChanges.isEmpty()); - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row " + ralphIndex + " is dirty", this.dataChangeLayer.isRowDirty(ralphIndex)); - assertFalse("Cell 0/" + ralphIndex + " is dirty", this.dataChangeLayer.isCellDirty(0, ralphIndex)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(ralphIndex), "Row " + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, ralphIndex), "Cell 0/" + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); int lastRowIndex = this.dataModel.size() - 1; - assertFalse("Row " + lastRowIndex + " is dirty", this.dataChangeLayer.isRowDirty(lastRowIndex)); - assertFalse("Cell 0/" + lastRowIndex + " is dirty", this.dataChangeLayer.isCellDirty(0, lastRowIndex)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(0, lastRowIndex).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isRowDirty(lastRowIndex), "Row " + lastRowIndex + " is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, lastRowIndex), "Cell 0/" + lastRowIndex + " is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(0, lastRowIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); } @Test @@ -346,23 +346,23 @@ public class RowStructuralDataChangeIdIndexTest { assertFalse(this.dataModel.contains(toDelete)); // row deleted so all columns are actually dirty - assertTrue("Column 0 is not dirty", this.dataChangeLayer.isColumnDirty(0)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Column 2 is not dirty", this.dataChangeLayer.isColumnDirty(2)); - assertTrue("Column 3 is not dirty", this.dataChangeLayer.isColumnDirty(3)); - assertTrue("Column 4 is not dirty", this.dataChangeLayer.isColumnDirty(4)); + assertTrue(this.dataChangeLayer.isColumnDirty(0), "Column 0 is not dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(2), "Column 2 is not dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(3), "Column 3 is not dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(4), "Column 4 is not dirty"); - assertFalse("Row 9 is dirty", this.dataChangeLayer.isRowDirty(9)); - assertFalse("Row 10 is dirty", this.dataChangeLayer.isRowDirty(10)); - assertFalse("Row 11 is dirty", this.dataChangeLayer.isRowDirty(11)); + assertFalse(this.dataChangeLayer.isRowDirty(9), "Row 9 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(10), "Row 10 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(11), "Row 11 is dirty"); - assertFalse("Cell 0/9 is dirty", this.dataChangeLayer.isCellDirty(0, 9)); - assertFalse("Cell 0/10 is dirty", this.dataChangeLayer.isCellDirty(0, 10)); - assertFalse("Cell 0/11 is dirty", this.dataChangeLayer.isCellDirty(0, 11)); + assertFalse(this.dataChangeLayer.isCellDirty(0, 9), "Cell 0/9 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, 10), "Cell 0/10 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, 11), "Cell 0/11 is dirty"); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(0, 9).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(2, 11).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(0, 9).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(2, 11).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); assertEquals(1, this.dataChangeLayer.dataChanges.size()); assertEquals(1, this.deleteHandler.dataChanges.size()); @@ -386,10 +386,10 @@ public class RowStructuralDataChangeIdIndexTest { assertEquals(1, this.dataChangeLayer.dataChanges.size()); assertEquals(1, this.deleteHandler.dataChanges.size()); - assertTrue("Column 0 is not dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row 10 is dirty", this.dataChangeLayer.isRowDirty(10)); - assertFalse("Cell 0/10 is dirty", this.dataChangeLayer.isCellDirty(0, 10)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); + assertTrue(this.dataChangeLayer.isColumnDirty(0), "Column 0 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(10), "Row 10 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, 10), "Cell 0/10 is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); RowDeleteDataChange change = this.deleteHandler.dataChanges.get(Integer.valueOf(10)); assertNotNull(change); @@ -405,10 +405,10 @@ public class RowStructuralDataChangeIdIndexTest { assertTrue(this.dataChangeLayer.dataChanges.isEmpty()); assertTrue(this.deleteHandler.dataChanges.isEmpty()); - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row 10 is dirty", this.dataChangeLayer.isRowDirty(10)); - assertFalse("Cell 0/10 is dirty", this.dataChangeLayer.isCellDirty(0, 10)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(10), "Row 10 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, 10), "Cell 0/10 is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); } @Test @@ -427,10 +427,10 @@ public class RowStructuralDataChangeIdIndexTest { assertTrue(this.dataChangeLayer.dataChanges.isEmpty()); assertTrue(this.deleteHandler.dataChanges.isEmpty()); - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row 10 is dirty", this.dataChangeLayer.isRowDirty(10)); - assertFalse("Cell 0/10 is dirty", this.dataChangeLayer.isCellDirty(0, 10)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(10), "Row 10 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, 10), "Cell 0/10 is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); } @Test @@ -456,10 +456,10 @@ public class RowStructuralDataChangeIdIndexTest { assertTrue(this.dataChangeLayer.dataChanges.isEmpty()); assertTrue(this.deleteHandler.dataChanges.isEmpty()); - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row 10 is dirty", this.dataChangeLayer.isRowDirty(10)); - assertFalse("Cell 0/10 is dirty", this.dataChangeLayer.isCellDirty(0, 10)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(10), "Row 10 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, 10), "Cell 0/10 is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); } @Test @@ -478,10 +478,10 @@ public class RowStructuralDataChangeIdIndexTest { assertTrue(this.dataChangeLayer.dataChanges.isEmpty()); assertTrue(this.deleteHandler.dataChanges.isEmpty()); - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row 10 is dirty", this.dataChangeLayer.isRowDirty(10)); - assertFalse("Cell 0/10 is dirty", this.dataChangeLayer.isCellDirty(0, 10)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(10), "Row 10 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, 10), "Cell 0/10 is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); } @Test @@ -515,10 +515,10 @@ public class RowStructuralDataChangeIdIndexTest { assertTrue(this.dataChangeLayer.dataChanges.isEmpty()); assertTrue(this.deleteHandler.dataChanges.isEmpty()); - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row 10 is dirty", this.dataChangeLayer.isRowDirty(10)); - assertFalse("Cell 0/10 is dirty", this.dataChangeLayer.isCellDirty(0, 10)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(10), "Row 10 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, 10), "Cell 0/10 is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); } @Test @@ -594,8 +594,8 @@ public class RowStructuralDataChangeIdIndexTest { // ensure that there is no Clancy or Ralph in an item afterwards for (Person p : this.dataModel) { - assertFalse("Clancy found", "Clancy".equals(p.getFirstName())); - assertFalse("Ralph found", "Ralph".equals(p.getFirstName())); + assertFalse("Clancy".equals(p.getFirstName()), "Clancy found"); + assertFalse("Ralph".equals(p.getFirstName()), "Ralph found"); } } @@ -607,7 +607,7 @@ public class RowStructuralDataChangeIdIndexTest { this.dataChangeLayer.doCommand(new UpdateDataCommand(this.dataChangeLayer, 1, 1, "Lovejoy")); assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 1)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertTrue(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); Person prev = this.dataModel.get(0); @@ -619,8 +619,8 @@ public class RowStructuralDataChangeIdIndexTest { // change has moved one row assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 2)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 2)); - assertFalse("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertTrue(this.dataChangeLayer.isCellDirty(1, 2), "Cell is not dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); // discard the changes this.dataChangeLayer.doCommand(new DiscardDataChangesCommand()); @@ -631,8 +631,8 @@ public class RowStructuralDataChangeIdIndexTest { // ensure that there is no Wiggum and no Lovejoy in an item afterwards for (Person p : this.dataModel) { - assertFalse("Lovejoy found", "Lovejoy".equals(p.getLastName())); - assertFalse("Wiggum found", "Wiggum".equals(p.getLastName())); + assertFalse("Lovejoy".equals(p.getLastName()), "Lovejoy found"); + assertFalse("Wiggum".equals(p.getLastName()), "Wiggum found"); } } @@ -644,7 +644,7 @@ public class RowStructuralDataChangeIdIndexTest { this.dataChangeLayer.doCommand(new UpdateDataCommand(this.dataChangeLayer, 1, 1, "Lovejoy")); assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 1)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertTrue(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); Person prev = this.dataModel.get(0); @@ -656,13 +656,13 @@ public class RowStructuralDataChangeIdIndexTest { // change has moved one row assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 2)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 2)); - assertFalse("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertTrue(this.dataChangeLayer.isCellDirty(1, 2), "Cell is not dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); this.dataChangeLayer.doCommand(new UpdateDataCommand(this.dataChangeLayer, 1, 2, "Simpson")); assertEquals("Simpson", this.dataLayer.getDataValue(1, 2)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 2)); + assertFalse(this.dataChangeLayer.isCellDirty(1, 2), "Cell is dirty"); // discard the changes this.dataChangeLayer.doCommand(new DiscardDataChangesCommand()); @@ -673,8 +673,8 @@ public class RowStructuralDataChangeIdIndexTest { // ensure that there is no Wiggum and no Lovejoy in an item afterwards for (Person p : this.dataModel) { - assertFalse("Lovejoy found", "Lovejoy".equals(p.getLastName())); - assertFalse("Wiggum found", "Wiggum".equals(p.getLastName())); + assertFalse("Lovejoy".equals(p.getLastName()), "Lovejoy found"); + assertFalse("Wiggum".equals(p.getLastName()), "Wiggum found"); } } @@ -694,30 +694,30 @@ public class RowStructuralDataChangeIdIndexTest { assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 8)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 9)); assertEquals("Flanders", this.dataChangeLayer.getDataValueByPosition(1, 9)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 8 is not dirty", this.dataChangeLayer.isRowDirty(8)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 8)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(8), "Row 8 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 8), "Cell is not dirty"); - assertFalse("changed columns are empty", this.updateHandler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.updateHandler.changedRows.isEmpty()); - assertFalse("changes are empty", this.updateHandler.dataChanges.isEmpty()); - assertFalse("tracked changes are empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.updateHandler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.updateHandler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.updateHandler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are empty"); // now discard and check that previous state is restored correctly this.dataChangeLayer.doCommand(new DiscardDataChangesCommand()); assertEquals("Simpson", this.dataLayer.getDataValue(1, 9)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 10)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 9 is dirty", this.dataChangeLayer.isRowDirty(9)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 9)); - - assertTrue("changed columns are not empty", this.updateHandler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.updateHandler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.updateHandler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(9), "Row 9 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 9), "Cell is dirty"); + + assertTrue(this.updateHandler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.updateHandler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.updateHandler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -742,32 +742,32 @@ public class RowStructuralDataChangeIdIndexTest { assertEquals("Wiggum", this.dataLayer.getDataValue(1, 9)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 10)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 9 is not dirty", this.dataChangeLayer.isRowDirty(9)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 9)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(9), "Row 9 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 9), "Cell is not dirty"); - assertTrue("changed columns are empty", this.updateHandler.changedColumns.isEmpty()); - assertTrue("changed rows are empty", this.updateHandler.changedRows.isEmpty()); - assertTrue("changes are empty", this.updateHandler.dataChanges.isEmpty()); - assertFalse("changed columns are empty", this.insertHandler.dataChanges.isEmpty()); - assertFalse("tracked changes are empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertTrue(this.updateHandler.changedColumns.isEmpty(), "changed columns are empty"); + assertTrue(this.updateHandler.changedRows.isEmpty(), "changed rows are empty"); + assertTrue(this.updateHandler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.insertHandler.dataChanges.isEmpty(), "changed columns are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are empty"); // now discard and check that previous state is restored correctly this.dataChangeLayer.doCommand(new DiscardDataChangesCommand()); assertEquals("Simpson", this.dataLayer.getDataValue(1, 9)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 10)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 9 is dirty", this.dataChangeLayer.isRowDirty(9)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 9)); - - assertTrue("changed columns are not empty", this.updateHandler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.updateHandler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.updateHandler.dataChanges.isEmpty()); - assertTrue("changed columns are empty", this.insertHandler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(9), "Row 9 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 9), "Cell is dirty"); + + assertTrue(this.updateHandler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.updateHandler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.updateHandler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.insertHandler.dataChanges.isEmpty(), "changed columns are empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -792,32 +792,32 @@ public class RowStructuralDataChangeIdIndexTest { assertEquals("Wiggum", this.dataLayer.getDataValue(1, 11)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 12)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 11).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 9 is not dirty", this.dataChangeLayer.isRowDirty(11)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 11)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 11).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(11), "Row 9 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 11), "Cell is not dirty"); - assertTrue("changed columns are empty", this.updateHandler.changedColumns.isEmpty()); - assertTrue("changed rows are empty", this.updateHandler.changedRows.isEmpty()); - assertTrue("changes are empty", this.updateHandler.dataChanges.isEmpty()); - assertFalse("changed columns are empty", this.insertHandler.dataChanges.isEmpty()); - assertFalse("tracked changes are empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertTrue(this.updateHandler.changedColumns.isEmpty(), "changed columns are empty"); + assertTrue(this.updateHandler.changedRows.isEmpty(), "changed rows are empty"); + assertTrue(this.updateHandler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.insertHandler.dataChanges.isEmpty(), "changed columns are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are empty"); // now discard and check that previous state is restored correctly this.dataChangeLayer.doCommand(new DiscardDataChangesCommand()); assertEquals("Simpson", this.dataLayer.getDataValue(1, 9)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 10)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 9 is dirty", this.dataChangeLayer.isRowDirty(9)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 9)); - - assertTrue("changed columns are not empty", this.updateHandler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.updateHandler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.updateHandler.dataChanges.isEmpty()); - assertTrue("changed columns are empty", this.insertHandler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(9), "Row 9 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 9), "Cell is dirty"); + + assertTrue(this.updateHandler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.updateHandler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.updateHandler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.insertHandler.dataChanges.isEmpty(), "changed columns are empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -837,30 +837,30 @@ public class RowStructuralDataChangeIdIndexTest { assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 10)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 11)); assertEquals("Flanders", this.dataChangeLayer.getDataValueByPosition(1, 11)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(10)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 10)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(10), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 10), "Cell is not dirty"); - assertFalse("changed columns are empty", this.updateHandler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.updateHandler.changedRows.isEmpty()); - assertFalse("changes are empty", this.updateHandler.dataChanges.isEmpty()); - assertFalse("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.updateHandler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.updateHandler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.updateHandler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); // now discard and check that previous state is restored correctly this.dataChangeLayer.doCommand(new DiscardDataChangesCommand()); assertEquals("Simpson", this.dataLayer.getDataValue(1, 9)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 10)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 9 is dirty", this.dataChangeLayer.isRowDirty(9)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 9)); - - assertTrue("changed columns are not empty", this.updateHandler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.updateHandler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.updateHandler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(9), "Row 9 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 9), "Cell is dirty"); + + assertTrue(this.updateHandler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.updateHandler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.updateHandler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -888,15 +888,15 @@ public class RowStructuralDataChangeIdIndexTest { // no row dirty for (int row = 0; row < this.dataModel.size(); row++) { - assertFalse("Row " + row + " is dirty", this.dataChangeLayer.isRowDirty(row)); + assertFalse(this.dataChangeLayer.isRowDirty(row), "Row " + row + " is dirty"); } - assertTrue("changed columns are empty", this.updateHandler.changedColumns.isEmpty()); - assertTrue("changed rows are empty", this.updateHandler.changedRows.isEmpty()); - assertTrue("changes are empty", this.updateHandler.dataChanges.isEmpty()); - assertFalse("insert handler changes are empty", this.insertHandler.dataChanges.isEmpty()); - assertFalse("delete handler changes are empty", this.deleteHandler.dataChanges.isEmpty()); - assertFalse("tracked changes are empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertTrue(this.updateHandler.changedColumns.isEmpty(), "changed columns are empty"); + assertTrue(this.updateHandler.changedRows.isEmpty(), "changed rows are empty"); + assertTrue(this.updateHandler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.insertHandler.dataChanges.isEmpty(), "insert handler changes are empty"); + assertFalse(this.deleteHandler.dataChanges.isEmpty(), "delete handler changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are empty"); // now discard and check that previous state is restored correctly this.dataChangeLayer.doCommand(new DiscardDataChangesCommand()); @@ -906,15 +906,15 @@ public class RowStructuralDataChangeIdIndexTest { // no row dirty for (int row = 0; row < this.dataModel.size(); row++) { - assertFalse("Row " + row + " is dirty", this.dataChangeLayer.isRowDirty(row)); + assertFalse(this.dataChangeLayer.isRowDirty(row), "Row " + row + " is dirty"); } - assertTrue("changed columns are not empty", this.updateHandler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.updateHandler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.updateHandler.dataChanges.isEmpty()); - assertTrue("insert handler changes are not empty", this.insertHandler.dataChanges.isEmpty()); - assertTrue("delete handler changes are not empty", this.deleteHandler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertTrue(this.updateHandler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.updateHandler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.updateHandler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.insertHandler.dataChanges.isEmpty(), "insert handler changes are not empty"); + assertTrue(this.deleteHandler.dataChanges.isEmpty(), "delete handler changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/RowStructuralDataChangeTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/RowStructuralDataChangeTest.java index 2344109a..c3a25f22 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/RowStructuralDataChangeTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/RowStructuralDataChangeTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2020 Dirk Fauth. + * Copyright (c) 2018, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,10 +12,10 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.datachange; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Date; import java.util.List; @@ -35,8 +35,8 @@ import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService; import org.eclipse.nebula.widgets.nattable.edit.command.UpdateDataCommand; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.swt.graphics.Point; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowStructuralDataChangeTest { @@ -48,7 +48,7 @@ public class RowStructuralDataChangeTest { private RowInsertDataChangeHandler insertHandler; private RowDeleteDataChangeHandler deleteHandler; - @Before + @BeforeEach public void setup() { this.dataModel = PersonService.getFixedPersons(); this.dataProvider = new ListDataProvider<>( @@ -80,9 +80,9 @@ public class RowStructuralDataChangeTest { this.updateHandler = (PersistenceUpdateDataChangeHandler) h; } } - assertNotNull("RowInsertDataChangeHandler not found", this.insertHandler); - assertNotNull("RowDeleteDataChangeHandler not found", this.deleteHandler); - assertNotNull("PersistenceUpdateDataChangeHandler not found", this.updateHandler); + assertNotNull(this.insertHandler, "RowInsertDataChangeHandler not found"); + assertNotNull(this.deleteHandler, "RowDeleteDataChangeHandler not found"); + assertNotNull(this.updateHandler, "PersistenceUpdateDataChangeHandler not found"); } @Test @@ -96,25 +96,25 @@ public class RowStructuralDataChangeTest { assertEquals(19, this.dataModel.size()); // row added so all columns are actually dirty - assertTrue("Column 0 is not dirty", this.dataChangeLayer.isColumnDirty(0)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Column 2 is not dirty", this.dataChangeLayer.isColumnDirty(2)); - assertTrue("Column 3 is not dirty", this.dataChangeLayer.isColumnDirty(3)); - assertTrue("Column 4 is not dirty", this.dataChangeLayer.isColumnDirty(4)); - - assertTrue("Row " + ralphIndex + " is not dirty", this.dataChangeLayer.isRowDirty(ralphIndex)); - - assertTrue("Cell 0/" + ralphIndex + " is not dirty", this.dataChangeLayer.isCellDirty(0, ralphIndex)); - assertTrue("Cell 1/" + ralphIndex + " is not dirty", this.dataChangeLayer.isCellDirty(1, ralphIndex)); - assertTrue("Cell 2/" + ralphIndex + " is not dirty", this.dataChangeLayer.isCellDirty(2, ralphIndex)); - assertTrue("Cell 3/" + ralphIndex + " is not dirty", this.dataChangeLayer.isCellDirty(3, ralphIndex)); - assertTrue("Cell 4/" + ralphIndex + " is not dirty", this.dataChangeLayer.isCellDirty(4, ralphIndex)); - - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(2, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(3, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(4, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); + assertTrue(this.dataChangeLayer.isColumnDirty(0), "Column 0 is not dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(2), "Column 2 is not dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(3), "Column 3 is not dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(4), "Column 4 is not dirty"); + + assertTrue(this.dataChangeLayer.isRowDirty(ralphIndex), "Row " + ralphIndex + " is not dirty"); + + assertTrue(this.dataChangeLayer.isCellDirty(0, ralphIndex), "Cell 0/" + ralphIndex + " is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, ralphIndex), "Cell 1/" + ralphIndex + " is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(2, ralphIndex), "Cell 2/" + ralphIndex + " is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(3, ralphIndex), "Cell 3/" + ralphIndex + " is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(4, ralphIndex), "Cell 4/" + ralphIndex + " is not dirty"); + + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(2, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(3, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(4, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); assertEquals(1, this.dataChangeLayer.dataChanges.size()); assertEquals(1, this.insertHandler.dataChanges.size()); @@ -138,10 +138,10 @@ public class RowStructuralDataChangeTest { assertEquals(1, this.dataChangeLayer.dataChanges.size()); assertEquals(1, this.insertHandler.dataChanges.size()); - assertTrue("Column 0 is not dirty", this.dataChangeLayer.isColumnDirty(0)); - assertTrue("Row " + ralphIndex + " is not dirty", this.dataChangeLayer.isRowDirty(ralphIndex)); - assertTrue("Cell 0/" + ralphIndex + " is not dirty", this.dataChangeLayer.isCellDirty(0, ralphIndex)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); + assertTrue(this.dataChangeLayer.isColumnDirty(0), "Column 0 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(ralphIndex), "Row " + ralphIndex + " is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(0, ralphIndex), "Cell 0/" + ralphIndex + " is not dirty"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); Point identifier = (Point) this.insertHandler.dataChanges.get(key).getKey(); assertEquals(-1, identifier.x); @@ -156,10 +156,10 @@ public class RowStructuralDataChangeTest { assertTrue(this.dataChangeLayer.dataChanges.isEmpty()); assertTrue(this.insertHandler.dataChanges.isEmpty()); - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row " + ralphIndex + " is dirty", this.dataChangeLayer.isRowDirty(ralphIndex)); - assertFalse("Cell 0/" + ralphIndex + " is dirty", this.dataChangeLayer.isCellDirty(0, ralphIndex)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(ralphIndex), "Row " + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, ralphIndex), "Cell 0/" + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); } @Test @@ -183,10 +183,10 @@ public class RowStructuralDataChangeTest { assertTrue(this.dataChangeLayer.dataChanges.isEmpty()); assertTrue(this.insertHandler.dataChanges.isEmpty()); - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row " + ralphIndex + " is dirty", this.dataChangeLayer.isRowDirty(ralphIndex)); - assertFalse("Cell 0/" + ralphIndex + " is dirty", this.dataChangeLayer.isCellDirty(0, ralphIndex)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(ralphIndex), "Row " + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, ralphIndex), "Cell 0/" + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); } @Test @@ -214,10 +214,10 @@ public class RowStructuralDataChangeTest { assertTrue(this.dataChangeLayer.dataChanges.isEmpty()); assertTrue(this.insertHandler.dataChanges.isEmpty()); - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row " + ralphIndex + " is dirty", this.dataChangeLayer.isRowDirty(ralphIndex)); - assertFalse("Cell 0/" + ralphIndex + " is dirty", this.dataChangeLayer.isCellDirty(0, ralphIndex)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(ralphIndex), "Row " + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, ralphIndex), "Cell 0/" + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); } @Test @@ -237,10 +237,10 @@ public class RowStructuralDataChangeTest { assertTrue(this.dataChangeLayer.dataChanges.isEmpty()); assertTrue(this.insertHandler.dataChanges.isEmpty()); - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row " + ralphIndex + " is dirty", this.dataChangeLayer.isRowDirty(ralphIndex)); - assertFalse("Cell 0/" + ralphIndex + " is dirty", this.dataChangeLayer.isCellDirty(0, ralphIndex)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(ralphIndex), "Row " + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, ralphIndex), "Cell 0/" + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); } @Test @@ -275,10 +275,10 @@ public class RowStructuralDataChangeTest { assertTrue(this.dataChangeLayer.dataChanges.isEmpty()); assertTrue(this.insertHandler.dataChanges.isEmpty()); - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row " + ralphIndex + " is dirty", this.dataChangeLayer.isRowDirty(ralphIndex)); - assertFalse("Cell 0/" + ralphIndex + " is dirty", this.dataChangeLayer.isCellDirty(0, ralphIndex)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(ralphIndex), "Row " + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, ralphIndex), "Cell 0/" + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); } @Test @@ -307,21 +307,21 @@ public class RowStructuralDataChangeTest { assertEquals(18, this.dataModel.size()); for (Person p : this.dataModel) { - assertFalse("Wiggum found", "Wiggum".equals(p.getLastName())); + assertFalse("Wiggum".equals(p.getLastName()), "Wiggum found"); } assertTrue(this.dataChangeLayer.dataChanges.isEmpty()); assertTrue(this.insertHandler.dataChanges.isEmpty()); - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row " + ralphIndex + " is dirty", this.dataChangeLayer.isRowDirty(ralphIndex)); - assertFalse("Cell 0/" + ralphIndex + " is dirty", this.dataChangeLayer.isCellDirty(0, ralphIndex)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(ralphIndex), "Row " + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, ralphIndex), "Cell 0/" + ralphIndex + " is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); int lastRowIndex = this.dataModel.size() - 1; - assertFalse("Row " + lastRowIndex + " is dirty", this.dataChangeLayer.isRowDirty(lastRowIndex)); - assertFalse("Cell 0/" + lastRowIndex + " is dirty", this.dataChangeLayer.isCellDirty(0, lastRowIndex)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(0, lastRowIndex).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isRowDirty(lastRowIndex), "Row " + lastRowIndex + " is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, lastRowIndex), "Cell 0/" + lastRowIndex + " is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(0, lastRowIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); } @Test @@ -334,23 +334,23 @@ public class RowStructuralDataChangeTest { assertFalse(this.dataModel.contains(toDelete)); // row deleted so all columns are actually dirty - assertTrue("Column 0 is not dirty", this.dataChangeLayer.isColumnDirty(0)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Column 2 is not dirty", this.dataChangeLayer.isColumnDirty(2)); - assertTrue("Column 3 is not dirty", this.dataChangeLayer.isColumnDirty(3)); - assertTrue("Column 4 is not dirty", this.dataChangeLayer.isColumnDirty(4)); + assertTrue(this.dataChangeLayer.isColumnDirty(0), "Column 0 is not dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(2), "Column 2 is not dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(3), "Column 3 is not dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(4), "Column 4 is not dirty"); - assertFalse("Row 9 is dirty", this.dataChangeLayer.isRowDirty(9)); - assertFalse("Row 10 is dirty", this.dataChangeLayer.isRowDirty(10)); - assertFalse("Row 11 is dirty", this.dataChangeLayer.isRowDirty(11)); + assertFalse(this.dataChangeLayer.isRowDirty(9), "Row 9 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(10), "Row 10 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(11), "Row 11 is dirty"); - assertFalse("Cell 0/9 is dirty", this.dataChangeLayer.isCellDirty(0, 9)); - assertFalse("Cell 0/10 is dirty", this.dataChangeLayer.isCellDirty(0, 10)); - assertFalse("Cell 0/11 is dirty", this.dataChangeLayer.isCellDirty(0, 11)); + assertFalse(this.dataChangeLayer.isCellDirty(0, 9), "Cell 0/9 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, 10), "Cell 0/10 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, 11), "Cell 0/11 is dirty"); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(0, 9).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(2, 11).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(0, 9).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(2, 11).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); assertEquals(1, this.dataChangeLayer.dataChanges.size()); assertEquals(1, this.deleteHandler.dataChanges.size()); @@ -374,10 +374,10 @@ public class RowStructuralDataChangeTest { assertEquals(1, this.dataChangeLayer.dataChanges.size()); assertEquals(1, this.deleteHandler.dataChanges.size()); - assertTrue("Column 0 is not dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row 10 is dirty", this.dataChangeLayer.isRowDirty(10)); - assertFalse("Cell 0/10 is dirty", this.dataChangeLayer.isCellDirty(0, 10)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); + assertTrue(this.dataChangeLayer.isColumnDirty(0), "Column 0 is not dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(10), "Row 10 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, 10), "Cell 0/10 is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); RowDeleteDataChange change = this.deleteHandler.dataChanges.get(Integer.valueOf(10)); assertNotNull(change); @@ -393,10 +393,10 @@ public class RowStructuralDataChangeTest { assertTrue(this.dataChangeLayer.dataChanges.isEmpty()); assertTrue(this.deleteHandler.dataChanges.isEmpty()); - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row 10 is dirty", this.dataChangeLayer.isRowDirty(10)); - assertFalse("Cell 0/10 is dirty", this.dataChangeLayer.isCellDirty(0, 10)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(10), "Row 10 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, 10), "Cell 0/10 is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); } @Test @@ -415,10 +415,10 @@ public class RowStructuralDataChangeTest { assertTrue(this.dataChangeLayer.dataChanges.isEmpty()); assertTrue(this.deleteHandler.dataChanges.isEmpty()); - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row 10 is dirty", this.dataChangeLayer.isRowDirty(10)); - assertFalse("Cell 0/10 is dirty", this.dataChangeLayer.isCellDirty(0, 10)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(10), "Row 10 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, 10), "Cell 0/10 is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); } @Test @@ -444,10 +444,10 @@ public class RowStructuralDataChangeTest { assertTrue(this.dataChangeLayer.dataChanges.isEmpty()); assertTrue(this.deleteHandler.dataChanges.isEmpty()); - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row 10 is dirty", this.dataChangeLayer.isRowDirty(10)); - assertFalse("Cell 0/10 is dirty", this.dataChangeLayer.isCellDirty(0, 10)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(10), "Row 10 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, 10), "Cell 0/10 is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); } @Test @@ -466,10 +466,10 @@ public class RowStructuralDataChangeTest { assertTrue(this.dataChangeLayer.dataChanges.isEmpty()); assertTrue(this.deleteHandler.dataChanges.isEmpty()); - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row 10 is dirty", this.dataChangeLayer.isRowDirty(10)); - assertFalse("Cell 0/10 is dirty", this.dataChangeLayer.isCellDirty(0, 10)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(10), "Row 10 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, 10), "Cell 0/10 is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); } @Test @@ -503,10 +503,10 @@ public class RowStructuralDataChangeTest { assertTrue(this.dataChangeLayer.dataChanges.isEmpty()); assertTrue(this.deleteHandler.dataChanges.isEmpty()); - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row 10 is dirty", this.dataChangeLayer.isRowDirty(10)); - assertFalse("Cell 0/10 is dirty", this.dataChangeLayer.isCellDirty(0, 10)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(10), "Row 10 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, 10), "Cell 0/10 is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); } @Test @@ -582,8 +582,8 @@ public class RowStructuralDataChangeTest { // ensure that there is no Clancy or Ralph in an item afterwards for (Person p : this.dataModel) { - assertFalse("Clancy found", "Clancy".equals(p.getFirstName())); - assertFalse("Ralph found", "Ralph".equals(p.getFirstName())); + assertFalse("Clancy".equals(p.getFirstName()), "Clancy found"); + assertFalse("Ralph".equals(p.getFirstName()), "Ralph found"); } } @@ -595,7 +595,7 @@ public class RowStructuralDataChangeTest { this.dataChangeLayer.doCommand(new UpdateDataCommand(this.dataChangeLayer, 1, 1, "Lovejoy")); assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 1)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertTrue(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); Person prev = this.dataModel.get(0); @@ -607,8 +607,8 @@ public class RowStructuralDataChangeTest { // change has moved one row assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 2)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 2)); - assertFalse("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertTrue(this.dataChangeLayer.isCellDirty(1, 2), "Cell is not dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); // discard the changes this.dataChangeLayer.doCommand(new DiscardDataChangesCommand()); @@ -619,8 +619,8 @@ public class RowStructuralDataChangeTest { // ensure that there is no Wiggum and no Lovejoy in an item afterwards for (Person p : this.dataModel) { - assertFalse("Lovejoy found", "Lovejoy".equals(p.getLastName())); - assertFalse("Wiggum found", "Wiggum".equals(p.getLastName())); + assertFalse("Lovejoy".equals(p.getLastName()), "Lovejoy found"); + assertFalse("Wiggum".equals(p.getLastName()), "Wiggum found"); } } @@ -632,7 +632,7 @@ public class RowStructuralDataChangeTest { this.dataChangeLayer.doCommand(new UpdateDataCommand(this.dataChangeLayer, 1, 1, "Lovejoy")); assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 1)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertTrue(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); Person prev = this.dataModel.get(0); @@ -644,13 +644,13 @@ public class RowStructuralDataChangeTest { // change has moved one row assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 2)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 2)); - assertFalse("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertTrue(this.dataChangeLayer.isCellDirty(1, 2), "Cell is not dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 1), "Cell is dirty"); this.dataChangeLayer.doCommand(new UpdateDataCommand(this.dataChangeLayer, 1, 2, "Simpson")); assertEquals("Simpson", this.dataLayer.getDataValue(1, 2)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 2)); + assertFalse(this.dataChangeLayer.isCellDirty(1, 2), "Cell is dirty"); // discard the changes this.dataChangeLayer.doCommand(new DiscardDataChangesCommand()); @@ -661,8 +661,8 @@ public class RowStructuralDataChangeTest { // ensure that there is no Wiggum and no Lovejoy in an item afterwards for (Person p : this.dataModel) { - assertFalse("Lovejoy found", "Lovejoy".equals(p.getLastName())); - assertFalse("Wiggum found", "Wiggum".equals(p.getLastName())); + assertFalse("Lovejoy".equals(p.getLastName()), "Lovejoy found"); + assertFalse("Wiggum".equals(p.getLastName()), "Wiggum found"); } } @@ -682,30 +682,30 @@ public class RowStructuralDataChangeTest { assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 8)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 9)); assertEquals("Flanders", this.dataChangeLayer.getDataValueByPosition(1, 9)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 8 is not dirty", this.dataChangeLayer.isRowDirty(8)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 8)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(8), "Row 8 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 8), "Cell is not dirty"); - assertFalse("changed columns are empty", this.updateHandler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.updateHandler.changedRows.isEmpty()); - assertFalse("changes are empty", this.updateHandler.dataChanges.isEmpty()); - assertFalse("tracked changes are empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.updateHandler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.updateHandler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.updateHandler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are empty"); // now discard and check that previous state is restored correctly this.dataChangeLayer.doCommand(new DiscardDataChangesCommand()); assertEquals("Simpson", this.dataLayer.getDataValue(1, 9)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 10)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 9 is dirty", this.dataChangeLayer.isRowDirty(9)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 9)); - - assertTrue("changed columns are not empty", this.updateHandler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.updateHandler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.updateHandler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(9), "Row 9 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 9), "Cell is dirty"); + + assertTrue(this.updateHandler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.updateHandler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.updateHandler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -730,32 +730,32 @@ public class RowStructuralDataChangeTest { assertEquals("Wiggum", this.dataLayer.getDataValue(1, 9)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 10)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 9 is not dirty", this.dataChangeLayer.isRowDirty(9)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 9)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(9), "Row 9 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 9), "Cell is not dirty"); - assertTrue("changed columns are empty", this.updateHandler.changedColumns.isEmpty()); - assertTrue("changed rows are empty", this.updateHandler.changedRows.isEmpty()); - assertTrue("changes are empty", this.updateHandler.dataChanges.isEmpty()); - assertFalse("changed columns are empty", this.insertHandler.dataChanges.isEmpty()); - assertFalse("tracked changes are empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertTrue(this.updateHandler.changedColumns.isEmpty(), "changed columns are empty"); + assertTrue(this.updateHandler.changedRows.isEmpty(), "changed rows are empty"); + assertTrue(this.updateHandler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.insertHandler.dataChanges.isEmpty(), "changed columns are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are empty"); // now discard and check that previous state is restored correctly this.dataChangeLayer.doCommand(new DiscardDataChangesCommand()); assertEquals("Simpson", this.dataLayer.getDataValue(1, 9)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 10)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 9 is dirty", this.dataChangeLayer.isRowDirty(9)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 9)); - - assertTrue("changed columns are not empty", this.updateHandler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.updateHandler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.updateHandler.dataChanges.isEmpty()); - assertTrue("changed columns are empty", this.insertHandler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(9), "Row 9 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 9), "Cell is dirty"); + + assertTrue(this.updateHandler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.updateHandler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.updateHandler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.insertHandler.dataChanges.isEmpty(), "changed columns are empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -780,32 +780,32 @@ public class RowStructuralDataChangeTest { assertEquals("Wiggum", this.dataLayer.getDataValue(1, 11)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 12)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 11).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 9 is not dirty", this.dataChangeLayer.isRowDirty(11)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 11)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 11).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(11), "Row 9 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 11), "Cell is not dirty"); - assertTrue("changed columns are empty", this.updateHandler.changedColumns.isEmpty()); - assertTrue("changed rows are empty", this.updateHandler.changedRows.isEmpty()); - assertTrue("changes are empty", this.updateHandler.dataChanges.isEmpty()); - assertFalse("changed columns are empty", this.insertHandler.dataChanges.isEmpty()); - assertFalse("tracked changes are empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertTrue(this.updateHandler.changedColumns.isEmpty(), "changed columns are empty"); + assertTrue(this.updateHandler.changedRows.isEmpty(), "changed rows are empty"); + assertTrue(this.updateHandler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.insertHandler.dataChanges.isEmpty(), "changed columns are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are empty"); // now discard and check that previous state is restored correctly this.dataChangeLayer.doCommand(new DiscardDataChangesCommand()); assertEquals("Simpson", this.dataLayer.getDataValue(1, 9)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 10)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 9 is dirty", this.dataChangeLayer.isRowDirty(9)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 9)); - - assertTrue("changed columns are not empty", this.updateHandler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.updateHandler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.updateHandler.dataChanges.isEmpty()); - assertTrue("changed columns are empty", this.insertHandler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(9), "Row 9 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 9), "Cell is dirty"); + + assertTrue(this.updateHandler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.updateHandler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.updateHandler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.insertHandler.dataChanges.isEmpty(), "changed columns are empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -825,30 +825,30 @@ public class RowStructuralDataChangeTest { assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 10)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 11)); assertEquals("Flanders", this.dataChangeLayer.getDataValueByPosition(1, 11)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(10)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 10)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(10), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 10), "Cell is not dirty"); - assertFalse("changed columns are empty", this.updateHandler.changedColumns.isEmpty()); - assertFalse("changed rows are empty", this.updateHandler.changedRows.isEmpty()); - assertFalse("changes are empty", this.updateHandler.dataChanges.isEmpty()); - assertFalse("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.updateHandler.changedColumns.isEmpty(), "changed columns are empty"); + assertFalse(this.updateHandler.changedRows.isEmpty(), "changed rows are empty"); + assertFalse(this.updateHandler.dataChanges.isEmpty(), "changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); // now discard and check that previous state is restored correctly this.dataChangeLayer.doCommand(new DiscardDataChangesCommand()); assertEquals("Simpson", this.dataLayer.getDataValue(1, 9)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 10)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY)); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); - assertFalse("Row 9 is dirty", this.dataChangeLayer.isRowDirty(9)); - assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 9)); - - assertTrue("changed columns are not empty", this.updateHandler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.updateHandler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.updateHandler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(9), "Row 9 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(1, 9), "Cell is dirty"); + + assertTrue(this.updateHandler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.updateHandler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.updateHandler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } @Test @@ -876,17 +876,17 @@ public class RowStructuralDataChangeTest { // no row dirty for (int row = 0; row < this.dataModel.size(); row++) { - assertFalse("Row " + row + " is dirty", this.dataChangeLayer.isRowDirty(row)); + assertFalse(this.dataChangeLayer.isRowDirty(row), "Row " + row + " is dirty"); } - assertTrue("changed columns are empty", this.updateHandler.changedColumns.isEmpty()); - assertTrue("changed rows are empty", this.updateHandler.changedRows.isEmpty()); - assertTrue("changes are empty", this.updateHandler.dataChanges.isEmpty()); + assertTrue(this.updateHandler.changedColumns.isEmpty(), "changed columns are empty"); + assertTrue(this.updateHandler.changedRows.isEmpty(), "changed rows are empty"); + assertTrue(this.updateHandler.dataChanges.isEmpty(), "changes are empty"); // now empty because the key handler specifies key updates and the // inserted value is removed - assertTrue("insert handler changes are not empty", this.insertHandler.dataChanges.isEmpty()); - assertFalse("delete handler changes are empty", this.deleteHandler.dataChanges.isEmpty()); - assertFalse("tracked changes are empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertTrue(this.insertHandler.dataChanges.isEmpty(), "insert handler changes are not empty"); + assertFalse(this.deleteHandler.dataChanges.isEmpty(), "delete handler changes are empty"); + assertFalse(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are empty"); // now discard and check that previous state is restored correctly this.dataChangeLayer.doCommand(new DiscardDataChangesCommand()); @@ -896,15 +896,15 @@ public class RowStructuralDataChangeTest { // no row dirty for (int row = 0; row < this.dataModel.size(); row++) { - assertFalse("Row " + row + " is dirty", this.dataChangeLayer.isRowDirty(row)); + assertFalse(this.dataChangeLayer.isRowDirty(row), "Row " + row + " is dirty"); } - assertTrue("changed columns are not empty", this.updateHandler.changedColumns.isEmpty()); - assertTrue("changed rows are not empty", this.updateHandler.changedRows.isEmpty()); - assertTrue("changes are not empty", this.updateHandler.dataChanges.isEmpty()); - assertTrue("insert handler changes are not empty", this.insertHandler.dataChanges.isEmpty()); - assertTrue("delete handler changes are not empty", this.deleteHandler.dataChanges.isEmpty()); - assertTrue("tracked changes are not empty", this.dataChangeLayer.dataChanges.isEmpty()); + assertTrue(this.updateHandler.changedColumns.isEmpty(), "changed columns are not empty"); + assertTrue(this.updateHandler.changedRows.isEmpty(), "changed rows are not empty"); + assertTrue(this.updateHandler.dataChanges.isEmpty(), "changes are not empty"); + assertTrue(this.insertHandler.dataChanges.isEmpty(), "insert handler changes are not empty"); + assertTrue(this.deleteHandler.dataChanges.isEmpty(), "delete handler changes are not empty"); + assertTrue(this.dataChangeLayer.dataChanges.isEmpty(), "tracked changes are not empty"); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/command/KeyRowInsertCommandTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/command/KeyRowInsertCommandTest.java index 05d35118..b8485722 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/command/KeyRowInsertCommandTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/datachange/command/KeyRowInsertCommandTest.java @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.datachange.command; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.Serializable; import java.util.Date; @@ -48,8 +48,8 @@ import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class KeyRowInsertCommandTest { @@ -59,7 +59,7 @@ public class KeyRowInsertCommandTest { private ViewportLayer viewportLayer; private LayerListenerFixture listener; - @Before + @BeforeEach public void setup() { this.dataModel = PersonService.getFixedPersons(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/edit/command/EditUtilsTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/edit/command/EditUtilsTest.java index 8a9e38b0..01ecec9e 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/edit/command/EditUtilsTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/edit/command/EditUtilsTest.java @@ -12,11 +12,11 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.edit.command; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes; import org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate; @@ -31,8 +31,8 @@ import org.eclipse.nebula.widgets.nattable.layer.stack.DummyGridLayerStack; import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; import org.eclipse.nebula.widgets.nattable.style.DisplayMode; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class EditUtilsTest { @@ -42,7 +42,7 @@ public class EditUtilsTest { private DummyGridLayerStack gridLayerStack; private SelectionLayer selectionLayer; - @Before + @BeforeEach public void setup() { this.gridLayerStack = new DummyGridLayerStack(5, 5); this.selectionLayer = this.gridLayerStack.getBodyLayer().getSelectionLayer(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/edit/command/RowSelectionEditUtilsTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/edit/command/RowSelectionEditUtilsTest.java index 27522252..190d905a 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/edit/command/RowSelectionEditUtilsTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/edit/command/RowSelectionEditUtilsTest.java @@ -12,11 +12,11 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.edit.command; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.Serializable; import java.util.List; @@ -42,8 +42,8 @@ import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; import org.eclipse.nebula.widgets.nattable.style.DisplayMode; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowSelectionEditUtilsTest { @@ -53,7 +53,7 @@ public class RowSelectionEditUtilsTest { private GridLayerFixture gridLayerStack; private SelectionLayer selectionLayer; - @Before + @BeforeEach public void setup() { List<RowDataFixture> listFixture = RowDataListFixture.getList(10); IRowDataProvider<RowDataFixture> bodyDataProvider = diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/edit/gui/MultiCellEditDialogRunner.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/edit/gui/MultiCellEditDialogRunner.java index adacd592..6f641573 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/edit/gui/MultiCellEditDialogRunner.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/edit/gui/MultiCellEditDialogRunner.java @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.edit.gui; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes; import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry; diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/fillhandle/FillHandlePasteTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/fillhandle/FillHandlePasteTest.java index 8fd6df20..db4411e4 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/fillhandle/FillHandlePasteTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/fillhandle/FillHandlePasteTest.java @@ -13,9 +13,9 @@ *****************************************************************************/ package org.eclipse.nebula.widgets.nattable.fillhandle; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration; @@ -34,9 +34,9 @@ import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer.MoveDirectio import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class FillHandlePasteTest { @@ -44,7 +44,7 @@ public class FillHandlePasteTest { SelectionLayer selectionLayer = new SelectionLayer(new DataLayer(this.dataProvider)); NatTable natTable = new NatTableFixture(this.selectionLayer, false); - @Before + @BeforeEach public void setup() { this.natTable.addConfiguration(new FillHandleConfiguration(this.selectionLayer)); this.natTable.addConfiguration(new AbstractRegistryConfiguration() { @@ -59,7 +59,7 @@ public class FillHandlePasteTest { this.natTable.configure(); } - @After + @AfterEach public void tearDown() { this.selectionLayer.clear(); this.selectionLayer.setFillHandleRegion(null); @@ -895,9 +895,9 @@ public class FillHandlePasteTest { } } if (check) { - assertNull("Position " + i + "/" + j + " is not null", this.selectionLayer.getDataValueByPosition(i, j)); + assertNull(this.selectionLayer.getDataValueByPosition(i, j), "Position " + i + "/" + j + " is not null"); } else { - assertNotNull("Position " + i + "/" + j + " is null", this.selectionLayer.getDataValueByPosition(i, j)); + assertNotNull(this.selectionLayer.getDataValueByPosition(i, j), "Position " + i + "/" + j + " is null"); } } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/fillhandle/FillHandleSeriesTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/fillhandle/FillHandleSeriesTest.java index 586a0149..e4b0992e 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/fillhandle/FillHandleSeriesTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/fillhandle/FillHandleSeriesTest.java @@ -13,8 +13,8 @@ *****************************************************************************/ package org.eclipse.nebula.widgets.nattable.fillhandle; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import java.math.BigDecimal; import java.math.BigInteger; @@ -38,9 +38,9 @@ import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer.MoveDirectionEnum; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.swt.graphics.Rectangle; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class FillHandleSeriesTest { @@ -48,7 +48,7 @@ public class FillHandleSeriesTest { SelectionLayer selectionLayer = new SelectionLayer(new DataLayer(this.dataProvider)); NatTable natTable = new NatTableFixture(this.selectionLayer, false); - @Before + @BeforeEach public void setup() { this.natTable.addConfiguration(new FillHandleConfiguration(this.selectionLayer)); this.natTable.addConfiguration(new AbstractRegistryConfiguration() { @@ -63,7 +63,7 @@ public class FillHandleSeriesTest { this.natTable.configure(); } - @After + @AfterEach public void tearDown() { this.selectionLayer.clear(); this.selectionLayer.setFillHandleRegion(null); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/filterrow/combobox/FilterRowComboBoxDataProviderTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/filterrow/combobox/FilterRowComboBoxDataProviderTest.java index 8348bbe2..ece318b7 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/filterrow/combobox/FilterRowComboBoxDataProviderTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/filterrow/combobox/FilterRowComboBoxDataProviderTest.java @@ -12,8 +12,8 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.filterrow.combobox; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import java.util.ArrayList; import java.util.Date; @@ -23,8 +23,8 @@ import org.eclipse.nebula.widgets.nattable.data.IColumnAccessor; import org.eclipse.nebula.widgets.nattable.data.ListDataProvider; import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class FilterRowComboBoxDataProviderTest { @@ -38,7 +38,7 @@ public class FilterRowComboBoxDataProviderTest { "birthday", "city" }); - @Before + @BeforeEach public void setup() { DataLayer dataLayer = new DataLayer( diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/FormulaDataProviderTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/FormulaDataProviderTest.java index e47bdfa7..51474800 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/FormulaDataProviderTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/FormulaDataProviderTest.java @@ -13,12 +13,12 @@ *****************************************************************************/ package org.eclipse.nebula.widgets.nattable.formula; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.math.BigDecimal; import org.eclipse.nebula.widgets.nattable.data.IDataProvider; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class FormulaDataProviderTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/FormulaDisplayConverterTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/FormulaDisplayConverterTest.java index 60209537..2e460742 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/FormulaDisplayConverterTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/FormulaDisplayConverterTest.java @@ -13,7 +13,7 @@ *****************************************************************************/ package org.eclipse.nebula.widgets.nattable.formula; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.text.DecimalFormat; import java.util.Locale; @@ -21,7 +21,7 @@ import java.util.Locale; import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry; import org.eclipse.nebula.widgets.nattable.data.IDataProvider; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class FormulaDisplayConverterTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/FormulaFillHandlePasteTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/FormulaFillHandlePasteTest.java index fce6cd77..90674493 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/FormulaFillHandlePasteTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/FormulaFillHandlePasteTest.java @@ -13,9 +13,9 @@ *****************************************************************************/ package org.eclipse.nebula.widgets.nattable.formula; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import java.math.BigDecimal; @@ -38,9 +38,9 @@ import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer.MoveDirectio import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class FormulaFillHandlePasteTest { @@ -49,7 +49,7 @@ public class FormulaFillHandlePasteTest { SelectionLayer selectionLayer = new SelectionLayer(new DataLayer(this.formulaDataProvider)); NatTable natTable = new NatTableFixture(this.selectionLayer, false); - @Before + @BeforeEach public void setup() { InternalCellClipboard clipboard = new InternalCellClipboard(); this.selectionLayer.registerCommandHandler( @@ -74,7 +74,7 @@ public class FormulaFillHandlePasteTest { this.natTable.configure(); } - @After + @AfterEach public void tearDown() { this.selectionLayer.clear(); this.selectionLayer.setFillHandleRegion(null); @@ -259,9 +259,9 @@ public class FormulaFillHandlePasteTest { } } if (check) { - assertNull("Position " + i + "/" + j + " is not null", this.selectionLayer.getDataValueByPosition(i, j)); + assertNull(this.selectionLayer.getDataValueByPosition(i, j), "Position " + i + "/" + j + " is not null"); } else { - assertNotNull("Position " + i + "/" + j + " is null", this.selectionLayer.getDataValueByPosition(i, j)); + assertNotNull(this.selectionLayer.getDataValueByPosition(i, j), "Position " + i + "/" + j + " is null"); } } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/FormulaIntegrationTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/FormulaIntegrationTest.java index 452ede81..4a766655 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/FormulaIntegrationTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/FormulaIntegrationTest.java @@ -13,9 +13,9 @@ *****************************************************************************/ package org.eclipse.nebula.widgets.nattable.formula; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import java.math.BigDecimal; @@ -32,8 +32,8 @@ import org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent; import org.eclipse.nebula.widgets.nattable.layer.stack.DummyGridLayerStack; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class FormulaIntegrationTest { @@ -45,7 +45,7 @@ public class FormulaIntegrationTest { LayerListenerFixture listenerFixture = new LayerListenerFixture(); - @Before + @BeforeEach public void setup() { this.natTable.addConfiguration(new DefaultFormulaConfiguration( this.formulaDataProvider, diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/FormulaParserTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/FormulaParserTest.java index eef4b855..22c86482 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/FormulaParserTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/FormulaParserTest.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2015, 2020 CEA LIST. + * Copyright (c) 2015, 2022 CEA LIST. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -13,9 +13,10 @@ *****************************************************************************/ package org.eclipse.nebula.widgets.nattable.formula; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.math.BigDecimal; import java.math.RoundingMode; @@ -23,29 +24,27 @@ import java.text.DecimalFormat; import java.util.HashMap; import java.util.Locale; import java.util.Map; -import java.util.Set; -import org.eclipse.nebula.widgets.nattable.coordinate.IndexCoordinate; import org.eclipse.nebula.widgets.nattable.data.IDataProvider; import org.eclipse.nebula.widgets.nattable.formula.function.FunctionException; import org.eclipse.nebula.widgets.nattable.formula.function.FunctionValue; import org.eclipse.nebula.widgets.nattable.formula.function.ProductFunction; import org.eclipse.nebula.widgets.nattable.formula.function.SumFunction; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; public class FormulaParserTest { private static Locale defaultLocale; - @BeforeClass + @BeforeAll public static void setup() { defaultLocale = Locale.getDefault(); Locale.setDefault(Locale.ENGLISH); } - @AfterClass + @AfterAll public static void tearDown() { Locale.setDefault(defaultLocale); } @@ -53,9 +52,9 @@ public class FormulaParserTest { IDataProvider dataProvider = new TwoDimensionalArrayDataProvider(new Object[10][10]); FormulaParser parser = new FormulaParser(this.dataProvider); - @Test(expected = IllegalArgumentException.class) + @Test public void shouldThrowExceptionOnMissingOperator() { - this.parser.parseFunction("5 3"); + assertThrows(IllegalArgumentException.class, () -> this.parser.parseFunction("5 3")); } @Test @@ -176,58 +175,58 @@ public class FormulaParserTest { assertEquals(BigDecimal.valueOf(9.5), result.getValue()); } - @Test(expected = IllegalArgumentException.class) + @Test public void shouldThrowExceptionOnUnclosedParenthesis() { Map<Integer, FunctionValue> replacements = new HashMap<>(); - this.parser.processParenthesis("(5+3", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + assertThrows(IllegalArgumentException.class, () -> this.parser.processParenthesis("(5+3", replacements, new HashMap<>(), null)); } - @Test(expected = IllegalArgumentException.class) + @Test public void shouldThrowExceptionOnUnopenedParenthesis() { Map<Integer, FunctionValue> replacements = new HashMap<>(); - this.parser.processParenthesis("5+3)", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + assertThrows(IllegalArgumentException.class, () -> this.parser.processParenthesis("5+3)", replacements, new HashMap<>(), null)); } @Test public void shouldReplaceOneParenthesis() { Map<Integer, FunctionValue> replacements = new HashMap<>(); - String processed = this.parser.processParenthesis("(5+3)", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + String processed = this.parser.processParenthesis("(5+3)", replacements, new HashMap<>(), null); assertEquals("{0}", processed); assertEquals(1, replacements.size()); assertTrue(replacements.get(0) instanceof SumFunction); assertEquals(new BigDecimal(5 + 3), replacements.get(0).getValue()); replacements = new HashMap<>(); - processed = this.parser.processParenthesis("10 + (5+3)", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + processed = this.parser.processParenthesis("10 + (5+3)", replacements, new HashMap<>(), null); assertEquals("10 + {0}", processed); assertEquals(1, replacements.size()); assertTrue(replacements.get(0) instanceof SumFunction); assertEquals(new BigDecimal(5 + 3), replacements.get(0).getValue()); replacements = new HashMap<>(); - processed = this.parser.processParenthesis("(5+3) + 42", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + processed = this.parser.processParenthesis("(5+3) + 42", replacements, new HashMap<>(), null); assertEquals("{0} + 42", processed); assertEquals(1, replacements.size()); assertTrue(replacements.get(0) instanceof SumFunction); assertEquals(new BigDecimal(5 + 3), replacements.get(0).getValue()); } - @Test(expected = IllegalArgumentException.class) + @Test public void shouldThrowExceptionOnUnclosedTwoParenthesis() { Map<Integer, FunctionValue> replacements = new HashMap<>(); - this.parser.processParenthesis("(5+3) + (7 - 2", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + assertThrows(IllegalArgumentException.class, () -> this.parser.processParenthesis("(5+3) + (7 - 2", replacements, new HashMap<>(), null)); } - @Test(expected = IllegalArgumentException.class) + @Test public void shouldThrowExceptionOnUnopenedTwoParenthesis() { Map<Integer, FunctionValue> replacements = new HashMap<>(); - this.parser.processParenthesis("(5+3) + 7 - 3)", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + assertThrows(IllegalArgumentException.class, () -> this.parser.processParenthesis("(5+3) + 7 - 3)", replacements, new HashMap<>(), null)); } @Test public void shouldReplaceTwoParenthesis() { Map<Integer, FunctionValue> replacements = new HashMap<>(); - String processed = this.parser.processParenthesis("(5+3) - (5+5)", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + String processed = this.parser.processParenthesis("(5+3) - (5+5)", replacements, new HashMap<>(), null); assertEquals("{0} - {1}", processed); assertEquals(2, replacements.size()); assertTrue(replacements.get(0) instanceof SumFunction); @@ -236,7 +235,7 @@ public class FormulaParserTest { assertEquals(new BigDecimal(5 + 5), replacements.get(1).getValue()); replacements = new HashMap<>(); - processed = this.parser.processParenthesis("(5+3) + 10 + (5+5)", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + processed = this.parser.processParenthesis("(5+3) + 10 + (5+5)", replacements, new HashMap<>(), null); assertEquals("{0} + 10 + {1}", processed); assertEquals(2, replacements.size()); assertTrue(replacements.get(0) instanceof SumFunction); @@ -245,7 +244,7 @@ public class FormulaParserTest { assertEquals(new BigDecimal(5 + 5), replacements.get(1).getValue()); replacements = new HashMap<>(); - processed = this.parser.processParenthesis("10 + (5+3) + (5+5) + 42", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + processed = this.parser.processParenthesis("10 + (5+3) + (5+5) + 42", replacements, new HashMap<>(), null); assertEquals("10 + {0} + {1} + 42", processed); assertEquals(2, replacements.size()); assertTrue(replacements.get(0) instanceof SumFunction); @@ -254,7 +253,7 @@ public class FormulaParserTest { assertEquals(new BigDecimal(5 + 5), replacements.get(1).getValue()); replacements = new HashMap<>(); - processed = this.parser.processParenthesis("10 + (5+3) + 42 + (5+5)", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + processed = this.parser.processParenthesis("10 + (5+3) + 42 + (5+5)", replacements, new HashMap<>(), null); assertEquals("10 + {0} + 42 + {1}", processed); assertEquals(2, replacements.size()); assertTrue(replacements.get(0) instanceof SumFunction); @@ -263,36 +262,36 @@ public class FormulaParserTest { assertEquals(new BigDecimal(5 + 5), replacements.get(1).getValue()); } - @Test(expected = IllegalArgumentException.class) + @Test public void shouldThrowExceptionOnUnclosedNestedParanthesis() { Map<Integer, FunctionValue> replacements = new HashMap<>(); - this.parser.processParenthesis("((5+3 - 3)", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + assertThrows(IllegalArgumentException.class, () -> this.parser.processParenthesis("((5+3 - 3)", replacements, new HashMap<>(), null)); } - @Test(expected = IllegalArgumentException.class) + @Test public void shouldThrowExceptionOnUnopenedNestedParenthesis() { Map<Integer, FunctionValue> replacements = new HashMap<>(); - this.parser.processParenthesis("(5+3) + 7 - 3)", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + assertThrows(IllegalArgumentException.class, () -> this.parser.processParenthesis("(5+3) + 7 - 3)", replacements, new HashMap<>(), null)); } @Test public void shouldReplaceNestedParenthesis() { Map<Integer, FunctionValue> replacements = new HashMap<>(); - String processed = this.parser.processParenthesis("((5+3)*2)", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + String processed = this.parser.processParenthesis("((5+3)*2)", replacements, new HashMap<>(), null); assertEquals("{0}", processed); assertEquals(1, replacements.size()); assertTrue(replacements.get(0) instanceof ProductFunction); assertEquals(new BigDecimal(((5 + 3) * 2)), replacements.get(0).getValue()); replacements = new HashMap<>(); - processed = this.parser.processParenthesis("(2*(5+3))", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + processed = this.parser.processParenthesis("(2*(5+3))", replacements, new HashMap<>(), null); assertEquals("{0}", processed); assertEquals(1, replacements.size()); assertTrue(replacements.get(0) instanceof ProductFunction); assertEquals(new BigDecimal((2 * (5 + 3))), replacements.get(0).getValue()); replacements = new HashMap<>(); - processed = this.parser.processParenthesis("5+(2*(5+3))", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + processed = this.parser.processParenthesis("5+(2*(5+3))", replacements, new HashMap<>(), null); assertEquals("5+{0}", processed); assertEquals(1, replacements.size()); assertTrue(replacements.get(0) instanceof ProductFunction); @@ -425,21 +424,21 @@ public class FormulaParserTest { @Test public void shouldParseFunction() { Map<Integer, FunctionValue> replacements = new HashMap<>(); - String processed = this.parser.processFunctions("SUM(5; 3; 2)", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + String processed = this.parser.processFunctions("SUM(5; 3; 2)", replacements, new HashMap<>(), null); assertEquals("{0}", processed); assertEquals(1, replacements.size()); assertTrue(replacements.get(0) instanceof SumFunction); assertEquals(new BigDecimal((5 + 3 + 2)), replacements.get(0).getValue()); replacements = new HashMap<>(); - processed = this.parser.processFunctions("42 + SUM(5; 3; 2)", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + processed = this.parser.processFunctions("42 + SUM(5; 3; 2)", replacements, new HashMap<>(), null); assertEquals("42 + {0}", processed); assertEquals(1, replacements.size()); assertTrue(replacements.get(0) instanceof SumFunction); assertEquals(new BigDecimal((5 + 3 + 2)), replacements.get(0).getValue()); replacements = new HashMap<>(); - processed = this.parser.processFunctions("SUM(5; 3; 2) - 42", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + processed = this.parser.processFunctions("SUM(5; 3; 2) - 42", replacements, new HashMap<>(), null); assertEquals("{0} - 42", processed); assertEquals(1, replacements.size()); assertTrue(replacements.get(0) instanceof SumFunction); @@ -449,7 +448,7 @@ public class FormulaParserTest { @Test public void shouldParseMultipleFunction() { Map<Integer, FunctionValue> replacements = new HashMap<>(); - String processed = this.parser.processFunctions("SUM(5; 3; 2) - PRODUCT(2; 5)", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + String processed = this.parser.processFunctions("SUM(5; 3; 2) - PRODUCT(2; 5)", replacements, new HashMap<>(), null); assertEquals("{0} - {1}", processed); assertEquals(2, replacements.size()); assertTrue(replacements.get(0) instanceof SumFunction); @@ -461,24 +460,24 @@ public class FormulaParserTest { @Test public void shouldParseNestedFunctions() { Map<Integer, FunctionValue> replacements = new HashMap<>(); - String processed = this.parser.processFunctions("SUM(PRODUCT(2; 5); QUOTIENT(10; 5))", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + String processed = this.parser.processFunctions("SUM(PRODUCT(2; 5); QUOTIENT(10; 5))", replacements, new HashMap<>(), null); assertEquals("{0}", processed); assertEquals(1, replacements.size()); assertTrue(replacements.get(0) instanceof SumFunction); assertEquals(new BigDecimal((2 * 5) + (10 / 5)), replacements.get(0).getValue()); replacements = new HashMap<>(); - processed = this.parser.processFunctions("SUM(PRODUCT(2; SUM(2; 2)); 5)", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + processed = this.parser.processFunctions("SUM(PRODUCT(2; SUM(2; 2)); 5)", replacements, new HashMap<>(), null); assertEquals("{0}", processed); assertEquals(1, replacements.size()); assertTrue(replacements.get(0) instanceof SumFunction); assertEquals(new BigDecimal((2 * (2 + 2)) + 5), replacements.get(0).getValue()); } - @Test(expected = IllegalArgumentException.class) + @Test public void shouldThrowExceptionOnNotClosingFunction() { Map<Integer, FunctionValue> replacements = new HashMap<>(); - this.parser.processFunctions("SUM(5; 3; 2", replacements, new HashMap<IndexCoordinate, Set<IndexCoordinate>>(), null); + assertThrows(IllegalArgumentException.class, () -> this.parser.processFunctions("SUM(5; 3; 2", replacements, new HashMap<>(), null)); } @Test @@ -746,25 +745,25 @@ public class FormulaParserTest { assertFalse(this.parser.isIntegerValue(new BigDecimal("12.01"))); } - @Test(expected = FunctionException.class) + @Test public void shouldThrowExceptionOnUnsupportedTypes() { this.dataProvider.setDataValue(0, 0, "3"); this.dataProvider.setDataValue(1, 0, "a"); - this.parser.parseFunction("=PRODUCT(A1;B1)"); + assertThrows(FunctionException.class, () -> this.parser.parseFunction("=PRODUCT(A1;B1)")); } - @Test(expected = FunctionException.class) + @Test public void shouldThrowExceptionOnUnsupportedTypesInRange() { this.dataProvider.setDataValue(0, 0, "3"); this.dataProvider.setDataValue(1, 0, "a"); - this.parser.parseFunction("=PRODUCT(A1:B1)"); + assertThrows(FunctionException.class, () -> this.parser.parseFunction("=PRODUCT(A1:B1)")); } - @Test(expected = FunctionException.class) + @Test public void shouldThrowExceptionOnNegativeSqrt() { - this.parser.parseFunction("=SQRT(-9)"); + assertThrows(FunctionException.class, () -> this.parser.parseFunction("=SQRT(-9)")); } @Test @@ -781,9 +780,9 @@ public class FormulaParserTest { assertEquals(new BigDecimal("2.5"), result.getValue()); } - @Test(expected = FunctionException.class) + @Test public void shouldThrowExceptionOnWrongArgumentsMod() { - this.parser.parseFunction("=MOD(9)").getValue(); + assertThrows(FunctionException.class, () -> this.parser.parseFunction("=MOD(9)").getValue()); } @Test @@ -823,27 +822,27 @@ public class FormulaParserTest { assertEquals(new BigDecimal("4"), this.parser.parseFunction("=A2*B2").getValue()); } - @Test(expected = FunctionException.class) + @Test public void shouldThrowExceptionOnSelfReference() { this.dataProvider.setDataValue(0, 0, "=A1"); - this.parser.parseFunction("=A1"); + assertThrows(FunctionException.class, () -> this.parser.parseFunction("=A1")); } - @Test(expected = FunctionException.class) + @Test public void shouldNoticeSimpleCycleReference() { this.dataProvider.setDataValue(0, 0, "=B1"); this.dataProvider.setDataValue(1, 0, "=A1"); - this.parser.parseFunction("=A1"); + assertThrows(FunctionException.class, () -> this.parser.parseFunction("=A1")); } - @Test(expected = FunctionException.class) + @Test public void shouldNoticeCycleReference() { this.dataProvider.setDataValue(0, 0, "=B1"); this.dataProvider.setDataValue(1, 0, "=C1"); this.dataProvider.setDataValue(2, 0, "=A1"); - this.parser.parseFunction("=A1"); + assertThrows(FunctionException.class, () -> this.parser.parseFunction("=A1")); } @Test @@ -855,7 +854,7 @@ public class FormulaParserTest { assertEquals(new BigDecimal("0.625"), this.parser.parseFunction("=A1/D1").getValue()); } - @Test(expected = FunctionException.class) + @Test public void shouldNoticeCycleReferenceWithRange() { this.dataProvider.setDataValue(0, 0, "5"); this.dataProvider.setDataValue(0, 1, "5"); @@ -867,7 +866,7 @@ public class FormulaParserTest { // this should fail for circular dependencies this.dataProvider.setDataValue(2, 2, "=SUM(A3:C3)"); - this.parser.parseFunction("=C3"); + assertThrows(FunctionException.class, () -> this.parser.parseFunction("=C3")); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/function/FunctionTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/function/FunctionTest.java index 17c059d4..feb048fd 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/function/FunctionTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/formula/function/FunctionTest.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2015, 2020 CEA LIST. + * Copyright (c) 2015, 2022 CEA LIST. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -13,7 +13,8 @@ *****************************************************************************/ package org.eclipse.nebula.widgets.nattable.formula.function; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.math.BigDecimal; import java.math.RoundingMode; @@ -21,13 +22,13 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class FunctionTest { @Test public void shouldSumEmptyValues() { - FunctionValue function = new SumFunction(new ArrayList<FunctionValue>()); + FunctionValue function = new SumFunction(new ArrayList<>()); assertEquals(new BigDecimal(0), function.getValue()); } @@ -77,7 +78,7 @@ public class FunctionTest { @Test public void shouldAvgEmptyValues() { - FunctionValue function = new AverageFunction(new ArrayList<FunctionValue>()); + FunctionValue function = new AverageFunction(new ArrayList<>()); assertEquals(new BigDecimal(0), function.getValue()); } @@ -121,7 +122,7 @@ public class FunctionTest { @Test public void shouldMultiplyEmptyValues() { - FunctionValue function = new ProductFunction(new ArrayList<FunctionValue>()); + FunctionValue function = new ProductFunction(new ArrayList<>()); assertEquals(new BigDecimal(0), function.getValue()); } @@ -154,7 +155,7 @@ public class FunctionTest { @Test public void shouldDivideEmptyValues() { - FunctionValue function = new QuotientFunction(new ArrayList<FunctionValue>()); + FunctionValue function = new QuotientFunction(new ArrayList<>()); assertEquals(new BigDecimal(0), function.getValue()); } @@ -194,19 +195,19 @@ public class FunctionTest { assertEquals(new BigDecimal(5).divide(new BigDecimal(-3), 9, RoundingMode.HALF_UP), function.getValue()); } - @Test(expected = FunctionException.class) + @Test public void shouldThrowExceptionOnDivisionByZero() { List<FunctionValue> values = new ArrayList<>(); values.add(new BigDecimalFunctionValue(5)); values.add(new BigDecimalFunctionValue(0)); FunctionValue function = new QuotientFunction(values); - assertEquals(new BigDecimal(5), function.getValue()); + assertThrows(FunctionException.class, function::getValue); } - @Test(expected = IllegalArgumentException.class) + @Test public void shouldNegateEmptyValues() { - FunctionValue function = new NegateFunction(new ArrayList<FunctionValue>()); - assertEquals(new BigDecimal(0), function.getValue()); + FunctionValue function = new NegateFunction(new ArrayList<>()); + assertThrows(IllegalArgumentException.class, function::getValue); } @Test @@ -217,13 +218,12 @@ public class FunctionTest { assertEquals(new BigDecimal(-42), function.getValue()); } - @Test(expected = IllegalArgumentException.class) + @Test public void shouldNegateTwoValues() { List<FunctionValue> values = new ArrayList<>(); values.add(new BigDecimalFunctionValue(4)); values.add(new BigDecimalFunctionValue(2)); - FunctionValue function = new NegateFunction(values); - assertEquals(new BigDecimal(2), function.getValue()); + assertThrows(IllegalArgumentException.class, () -> new NegateFunction(values)); } @Test @@ -250,7 +250,7 @@ public class FunctionTest { @Test public void shouldPowerEmptyValues() { - FunctionValue function = new PowerFunction(new ArrayList<FunctionValue>()); + FunctionValue function = new PowerFunction(new ArrayList<>()); assertEquals(new BigDecimal(0), function.getValue()); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/freeze/CompositeFreezeLayerHideShowTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/freeze/CompositeFreezeLayerHideShowTest.java index 9d19cea9..504772f2 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/freeze/CompositeFreezeLayerHideShowTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/freeze/CompositeFreezeLayerHideShowTest.java @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.freeze; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.ArrayList; import java.util.Arrays; @@ -42,8 +42,8 @@ import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class CompositeFreezeLayerHideShowTest { @@ -83,7 +83,7 @@ public class CompositeFreezeLayerHideShowTest { private FreezeLayer freezeLayer; private CompositeFreezeLayer compositeFreezeLayer; - @Before + @BeforeEach public void setup() { this.dataLayer = new DataLayer(this.testDataProvider); this.reorderLayer = new ColumnReorderLayer(this.dataLayer); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/freeze/CompositeFreezeLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/freeze/CompositeFreezeLayerTest.java index a7d7a162..05cec921 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/freeze/CompositeFreezeLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/freeze/CompositeFreezeLayerTest.java @@ -25,8 +25,8 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.TestLayer; import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class CompositeFreezeLayerTest { @@ -37,7 +37,7 @@ public class CompositeFreezeLayerTest { private FreezeLayer freezeLayer; private CompositeFreezeLayer compositeFreezeLayer; - @Before + @BeforeEach public void setup() { TestLayer dataLayer = new TestLayer(4, 4, "0:0;100 | 1:1;100 | 2:2;100 | 3:3;100", diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/freeze/FreezeLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/freeze/FreezeLayerTest.java index 641a6054..3443f6ed 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/freeze/FreezeLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/freeze/FreezeLayerTest.java @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.freeze; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer; import org.eclipse.nebula.widgets.nattable.hideshow.command.ColumnHideCommand; @@ -20,8 +20,8 @@ import org.eclipse.nebula.widgets.nattable.hideshow.command.ShowAllColumnsComman import org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer; import org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.BaseDataLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class FreezeLayerTest { @@ -29,7 +29,7 @@ public class FreezeLayerTest { private ColumnHideShowLayer hideShowLayer; private ColumnReorderLayer reorderLayer; - @Before + @BeforeEach public void setup() { this.reorderLayer = new ColumnReorderLayer(new BaseDataLayerFixture(10, 10)); this.hideShowLayer = new ColumnHideShowLayer(this.reorderLayer); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/freeze/FreezeLayerTest2.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/freeze/FreezeLayerTest2.java index 03c4699f..306ddfa6 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/freeze/FreezeLayerTest2.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/freeze/FreezeLayerTest2.java @@ -14,14 +14,14 @@ package org.eclipse.nebula.widgets.nattable.freeze; import org.eclipse.nebula.widgets.nattable.test.LayerAssert; import org.eclipse.nebula.widgets.nattable.test.fixture.TestLayer; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class FreezeLayerTest2 { private FreezeLayer freezeLayer; - @Before + @BeforeEach public void setup() { TestLayer dataLayer = new TestLayer(4, 4, "0:0;100 | 1:1;100 | 2:2;100 | 3:3;100", diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/freeze/command/FreezeHandlerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/freeze/command/FreezeHandlerTest.java index 12e61289..2c8aca48 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/freeze/command/FreezeHandlerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/freeze/command/FreezeHandlerTest.java @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.freeze.command; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate; import org.eclipse.nebula.widgets.nattable.freeze.CompositeFreezeLayer; @@ -36,8 +36,8 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class FreezeHandlerTest { @@ -47,7 +47,7 @@ public class FreezeHandlerTest { private ViewportLayer viewportLayer; private SelectionLayer selectionLayer; - @Before + @BeforeEach public void setUp() { final DataLayer bodyDataLayer = new DataLayer(new DummyBodyDataProvider(10, 10)); final DefaultBodyLayerStack bodyLayer = new DefaultBodyLayerStack(bodyDataLayer); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/grid/GridLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/grid/GridLayerTest.java index d2d3ca5e..5b398f93 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/grid/GridLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/grid/GridLayerTest.java @@ -12,10 +12,10 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.grid; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.nebula.widgets.nattable.command.AbstractLayerCommandHandler; import org.eclipse.nebula.widgets.nattable.command.ILayerCommand; @@ -30,8 +30,8 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture; import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class GridLayerTest { @@ -42,7 +42,7 @@ public class GridLayerTest { private DataLayer rowHeaderDataLayer; private DataLayer cornerDataLayer; - @Before + @BeforeEach public void setup() { this.bodyDataLayer = new BaseDataLayerFixture(); this.columnHeaderDataLayer = new BaseDataLayerFixture(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/grid/command/RenameColumnHelperTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/grid/command/RenameColumnHelperTest.java index cc73f9b8..1719c074 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/grid/command/RenameColumnHelperTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/grid/command/RenameColumnHelperTest.java @@ -12,10 +12,10 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.grid.command; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Properties; @@ -23,8 +23,8 @@ import org.eclipse.nebula.widgets.nattable.columnRename.RenameColumnHelper; import org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnHeaderLayerFixture; import org.eclipse.nebula.widgets.nattable.test.integration.PersistenceIntegrationTest; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RenameColumnHelperTest { @@ -34,7 +34,7 @@ public class RenameColumnHelperTest { private static String PREFIX = PersistenceIntegrationTest.TEST_PERSISTENCE_PREFIX; private static String KEY = RenameColumnHelper.PERSISTENCE_KEY_RENAMED_COLUMN_HEADERS; - @Before + @BeforeEach public void setup() { ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayerFixture(); this.properties = new Properties(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/grid/data/DefaultColumnHeaderDataProviderTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/grid/data/DefaultColumnHeaderDataProviderTest.java index f62c3e70..2353f26c 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/grid/data/DefaultColumnHeaderDataProviderTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/grid/data/DefaultColumnHeaderDataProviderTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2020 Dirk Fauth. + * Copyright (c) 2017, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,14 +12,15 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.grid.data; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.util.HashMap; import java.util.Map; import org.eclipse.nebula.widgets.nattable.data.IDataProvider; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DefaultColumnHeaderDataProviderTest { @@ -61,11 +62,11 @@ public class DefaultColumnHeaderDataProviderTest { assertEquals("Vorname", dataProvider.getDataValue(0, 1)); } - @Test(expected = UnsupportedOperationException.class) + @Test public void shouldThrowExceptionOnSet() { IDataProvider dataProvider = new DefaultColumnHeaderDataProvider(new String[] { "One", "Two", "Three" }); - dataProvider.setDataValue(0, 0, "Foo"); + assertThrows(UnsupportedOperationException.class, () -> dataProvider.setDataValue(0, 0, "Foo")); } @Test diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupExpandCollapseLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupExpandCollapseLayerTest.java index 418b2558..14e31bc3 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupExpandCollapseLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupExpandCollapseLayerTest.java @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; import java.util.List; @@ -22,8 +22,8 @@ import java.util.List; import org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnHideShowLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnReorderLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnGroupExpandCollapseLayerTest { @@ -32,7 +32,7 @@ public class ColumnGroupExpandCollapseLayerTest { private ColumnGroupExpandCollapseLayer expandCollapseLayer; private ColumnHideShowLayerFixture underlyingLayer; - @Before + @BeforeEach public void setup() { this.model = new ColumnGroupModel(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupHeaderLayerSelectionTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupHeaderLayerSelectionTest.java index 1cfa9763..302571d6 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupHeaderLayerSelectionTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupHeaderLayerSelectionTest.java @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.Serializable; import java.util.ArrayList; @@ -51,8 +51,8 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnGroupHeaderLayerSelectionTest { @@ -69,7 +69,7 @@ public class ColumnGroupHeaderLayerSelectionTest { private LayerListenerFixture layerListener; - @Before + @BeforeEach public void setup() { this.dataProvider = new ListDataProvider<>( getNumberValues(), diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupHeaderLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupHeaderLayerTest.java index e66ee939..c956511a 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupHeaderLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupHeaderLayerTest.java @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.nebula.widgets.nattable.grid.GridRegion; import org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand; @@ -29,8 +29,8 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnGroupHeaderLayerTest { @@ -42,7 +42,7 @@ public class ColumnGroupHeaderLayerTest { private ColumnGroupModel model; private DefaultGridLayer gridLayer; - @Before + @BeforeEach public void setup() { this.gridLayer = new GridLayerFixture(); this.model = new ColumnGroupModel(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupModelPersistenceTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupModelPersistenceTest.java index 86a1897c..fc77f984 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupModelPersistenceTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupModelPersistenceTest.java @@ -12,17 +12,21 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.util.Properties; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnGroupModelPersistenceTest { private ColumnGroupModel model; - @Before + @BeforeEach public void setup() { this.model = new ColumnGroupModel(); } @@ -37,8 +41,8 @@ public class ColumnGroupModelPersistenceTest { Properties properties = new Properties(); this.model.saveState("prefix", properties); - Assert.assertEquals(1, properties.size()); - Assert.assertEquals( + assertEquals(1, properties.size()); + assertEquals( "groupA=expanded:collapseable:breakable:1,2,3,|groupB=collapsed:collapseable:unbreakable:5,7,9,|", properties.getProperty("prefix.columnGroups")); } @@ -54,8 +58,8 @@ public class ColumnGroupModelPersistenceTest { Properties properties = new Properties(); this.model.saveState("prefix", properties); - Assert.assertEquals(1, properties.size()); - Assert.assertEquals( + assertEquals(1, properties.size()); + assertEquals( "groupA=expanded:collapseable:breakable:1,2,3,:1,2,|groupB=collapsed:collapseable:unbreakable:5,7,9,|", properties.getProperty("prefix.columnGroups")); } @@ -70,36 +74,36 @@ public class ColumnGroupModelPersistenceTest { this.model.loadState("prefix", properties); - Assert.assertTrue(this.model.isAGroup("groupA")); - Assert.assertTrue(this.model.isAGroup("groupB")); + assertTrue(this.model.isAGroup("groupA")); + assertTrue(this.model.isAGroup("groupB")); - Assert.assertNull(this.model.getColumnGroupByIndex(0)); - Assert.assertEquals("groupA", this.model.getColumnGroupByIndex(1).getName()); - Assert.assertEquals("groupA", this.model.getColumnGroupByIndex(2).getName()); - Assert.assertEquals("groupA", this.model.getColumnGroupByIndex(3).getName()); - Assert.assertNull(this.model.getColumnGroupByIndex(4)); - Assert.assertEquals("groupB", this.model.getColumnGroupByIndex(5).getName()); - Assert.assertNull(this.model.getColumnGroupByIndex(6)); - Assert.assertEquals("groupB", this.model.getColumnGroupByIndex(7).getName()); - Assert.assertNull(this.model.getColumnGroupByIndex(8)); - Assert.assertEquals("groupB", this.model.getColumnGroupByIndex(9).getName()); - Assert.assertNull(this.model.getColumnGroupByIndex(10)); + assertNull(this.model.getColumnGroupByIndex(0)); + assertEquals("groupA", this.model.getColumnGroupByIndex(1).getName()); + assertEquals("groupA", this.model.getColumnGroupByIndex(2).getName()); + assertEquals("groupA", this.model.getColumnGroupByIndex(3).getName()); + assertNull(this.model.getColumnGroupByIndex(4)); + assertEquals("groupB", this.model.getColumnGroupByIndex(5).getName()); + assertNull(this.model.getColumnGroupByIndex(6)); + assertEquals("groupB", this.model.getColumnGroupByIndex(7).getName()); + assertNull(this.model.getColumnGroupByIndex(8)); + assertEquals("groupB", this.model.getColumnGroupByIndex(9).getName()); + assertNull(this.model.getColumnGroupByIndex(10)); - Assert.assertFalse(this.model.getColumnGroupByName("groupA").isCollapsed()); - Assert.assertTrue(this.model.getColumnGroupByName("groupB").isCollapsed()); + assertFalse(this.model.getColumnGroupByName("groupA").isCollapsed()); + assertTrue(this.model.getColumnGroupByName("groupB").isCollapsed()); - Assert.assertTrue(this.model.getColumnGroupByName("groupA").isCollapseable()); - Assert.assertTrue(this.model.getColumnGroupByName("groupB").isCollapseable()); + assertTrue(this.model.getColumnGroupByName("groupA").isCollapseable()); + assertTrue(this.model.getColumnGroupByName("groupB").isCollapseable()); - Assert.assertFalse(this.model.isPartOfAnUnbreakableGroup(1)); - Assert.assertFalse(this.model.isPartOfAnUnbreakableGroup(2)); - Assert.assertFalse(this.model.isPartOfAnUnbreakableGroup(3)); + assertFalse(this.model.isPartOfAnUnbreakableGroup(1)); + assertFalse(this.model.isPartOfAnUnbreakableGroup(2)); + assertFalse(this.model.isPartOfAnUnbreakableGroup(3)); - Assert.assertFalse(this.model.isPartOfAnUnbreakableGroup(4)); + assertFalse(this.model.isPartOfAnUnbreakableGroup(4)); - Assert.assertTrue(this.model.isPartOfAnUnbreakableGroup(5)); - Assert.assertTrue(this.model.isPartOfAnUnbreakableGroup(7)); - Assert.assertTrue(this.model.isPartOfAnUnbreakableGroup(9)); + assertTrue(this.model.isPartOfAnUnbreakableGroup(5)); + assertTrue(this.model.isPartOfAnUnbreakableGroup(7)); + assertTrue(this.model.isPartOfAnUnbreakableGroup(9)); } @Test @@ -112,42 +116,42 @@ public class ColumnGroupModelPersistenceTest { this.model.loadState("prefix", properties); - Assert.assertTrue(this.model.isAGroup("groupA")); - Assert.assertTrue(this.model.isAGroup("groupB")); + assertTrue(this.model.isAGroup("groupA")); + assertTrue(this.model.isAGroup("groupB")); - Assert.assertNull(this.model.getColumnGroupByIndex(0)); - Assert.assertEquals("groupA", this.model.getColumnGroupByIndex(1).getName()); - Assert.assertEquals("groupA", this.model.getColumnGroupByIndex(2).getName()); - Assert.assertEquals("groupA", this.model.getColumnGroupByIndex(3).getName()); - Assert.assertNull(this.model.getColumnGroupByIndex(4)); - Assert.assertEquals("groupB", this.model.getColumnGroupByIndex(5).getName()); - Assert.assertNull(this.model.getColumnGroupByIndex(6)); - Assert.assertEquals("groupB", this.model.getColumnGroupByIndex(7).getName()); - Assert.assertNull(this.model.getColumnGroupByIndex(8)); - Assert.assertEquals("groupB", this.model.getColumnGroupByIndex(9).getName()); - Assert.assertNull(this.model.getColumnGroupByIndex(10)); + assertNull(this.model.getColumnGroupByIndex(0)); + assertEquals("groupA", this.model.getColumnGroupByIndex(1).getName()); + assertEquals("groupA", this.model.getColumnGroupByIndex(2).getName()); + assertEquals("groupA", this.model.getColumnGroupByIndex(3).getName()); + assertNull(this.model.getColumnGroupByIndex(4)); + assertEquals("groupB", this.model.getColumnGroupByIndex(5).getName()); + assertNull(this.model.getColumnGroupByIndex(6)); + assertEquals("groupB", this.model.getColumnGroupByIndex(7).getName()); + assertNull(this.model.getColumnGroupByIndex(8)); + assertEquals("groupB", this.model.getColumnGroupByIndex(9).getName()); + assertNull(this.model.getColumnGroupByIndex(10)); - Assert.assertFalse(this.model.getColumnGroupByName("groupA").isCollapsed()); - Assert.assertTrue(this.model.getColumnGroupByName("groupB").isCollapsed()); + assertFalse(this.model.getColumnGroupByName("groupA").isCollapsed()); + assertTrue(this.model.getColumnGroupByName("groupB").isCollapsed()); - Assert.assertTrue(this.model.getColumnGroupByName("groupA").isCollapseable()); - Assert.assertTrue(this.model.getColumnGroupByName("groupB").isCollapseable()); + assertTrue(this.model.getColumnGroupByName("groupA").isCollapseable()); + assertTrue(this.model.getColumnGroupByName("groupB").isCollapseable()); - Assert.assertFalse(this.model.isPartOfAnUnbreakableGroup(1)); - Assert.assertFalse(this.model.isPartOfAnUnbreakableGroup(2)); - Assert.assertFalse(this.model.isPartOfAnUnbreakableGroup(3)); + assertFalse(this.model.isPartOfAnUnbreakableGroup(1)); + assertFalse(this.model.isPartOfAnUnbreakableGroup(2)); + assertFalse(this.model.isPartOfAnUnbreakableGroup(3)); - Assert.assertFalse(this.model.isPartOfAnUnbreakableGroup(4)); + assertFalse(this.model.isPartOfAnUnbreakableGroup(4)); - Assert.assertTrue(this.model.isPartOfAnUnbreakableGroup(5)); - Assert.assertTrue(this.model.isPartOfAnUnbreakableGroup(7)); - Assert.assertTrue(this.model.isPartOfAnUnbreakableGroup(9)); + assertTrue(this.model.isPartOfAnUnbreakableGroup(5)); + assertTrue(this.model.isPartOfAnUnbreakableGroup(7)); + assertTrue(this.model.isPartOfAnUnbreakableGroup(9)); - Assert.assertEquals(2, this.model.getColumnGroupByName("groupA") + assertEquals(2, this.model.getColumnGroupByName("groupA") .getStaticColumnIndexes().size()); - Assert.assertEquals(1, this.model.getColumnGroupByName("groupA") + assertEquals(1, this.model.getColumnGroupByName("groupA") .getStaticColumnIndexes().get(0).intValue()); - Assert.assertEquals(2, this.model.getColumnGroupByName("groupA") + assertEquals(2, this.model.getColumnGroupByName("groupA") .getStaticColumnIndexes().get(1).intValue()); } @@ -162,58 +166,58 @@ public class ColumnGroupModelPersistenceTest { Properties properties = new Properties(); this.model.saveState("prefix", properties); - Assert.assertEquals(1, properties.size()); - Assert.assertEquals( + assertEquals(1, properties.size()); + assertEquals( "groupA=expanded:collapseable:breakable:1,2,3,|groupB=collapsed:collapseable:unbreakable:5,7,9,:7,|", properties.getProperty("prefix.columnGroups")); ColumnGroupModel loadedModel = new ColumnGroupModel(); loadedModel.loadState("prefix", properties); - Assert.assertTrue(loadedModel.isAGroup("groupA")); - Assert.assertTrue(loadedModel.isAGroup("groupB")); + assertTrue(loadedModel.isAGroup("groupA")); + assertTrue(loadedModel.isAGroup("groupB")); - Assert.assertNull(loadedModel.getColumnGroupByIndex(0)); - Assert.assertEquals("groupA", loadedModel.getColumnGroupByIndex(1) + assertNull(loadedModel.getColumnGroupByIndex(0)); + assertEquals("groupA", loadedModel.getColumnGroupByIndex(1) .getName()); - Assert.assertEquals("groupA", loadedModel.getColumnGroupByIndex(2) + assertEquals("groupA", loadedModel.getColumnGroupByIndex(2) .getName()); - Assert.assertEquals("groupA", loadedModel.getColumnGroupByIndex(3) + assertEquals("groupA", loadedModel.getColumnGroupByIndex(3) .getName()); - Assert.assertNull(loadedModel.getColumnGroupByIndex(4)); - Assert.assertEquals("groupB", loadedModel.getColumnGroupByIndex(5) + assertNull(loadedModel.getColumnGroupByIndex(4)); + assertEquals("groupB", loadedModel.getColumnGroupByIndex(5) .getName()); - Assert.assertNull(loadedModel.getColumnGroupByIndex(6)); - Assert.assertEquals("groupB", loadedModel.getColumnGroupByIndex(7) + assertNull(loadedModel.getColumnGroupByIndex(6)); + assertEquals("groupB", loadedModel.getColumnGroupByIndex(7) .getName()); - Assert.assertNull(loadedModel.getColumnGroupByIndex(8)); - Assert.assertEquals("groupB", loadedModel.getColumnGroupByIndex(9) + assertNull(loadedModel.getColumnGroupByIndex(8)); + assertEquals("groupB", loadedModel.getColumnGroupByIndex(9) .getName()); - Assert.assertNull(loadedModel.getColumnGroupByIndex(10)); + assertNull(loadedModel.getColumnGroupByIndex(10)); - Assert.assertFalse(loadedModel.getColumnGroupByName("groupA") + assertFalse(loadedModel.getColumnGroupByName("groupA") .isCollapsed()); - Assert.assertTrue(loadedModel.getColumnGroupByName("groupB") + assertTrue(loadedModel.getColumnGroupByName("groupB") .isCollapsed()); - Assert.assertTrue(loadedModel.getColumnGroupByName("groupA") + assertTrue(loadedModel.getColumnGroupByName("groupA") .isCollapseable()); - Assert.assertTrue(loadedModel.getColumnGroupByName("groupB") + assertTrue(loadedModel.getColumnGroupByName("groupB") .isCollapseable()); - Assert.assertFalse(loadedModel.isPartOfAnUnbreakableGroup(1)); - Assert.assertFalse(loadedModel.isPartOfAnUnbreakableGroup(2)); - Assert.assertFalse(loadedModel.isPartOfAnUnbreakableGroup(3)); + assertFalse(loadedModel.isPartOfAnUnbreakableGroup(1)); + assertFalse(loadedModel.isPartOfAnUnbreakableGroup(2)); + assertFalse(loadedModel.isPartOfAnUnbreakableGroup(3)); - Assert.assertFalse(loadedModel.isPartOfAnUnbreakableGroup(4)); + assertFalse(loadedModel.isPartOfAnUnbreakableGroup(4)); - Assert.assertTrue(loadedModel.isPartOfAnUnbreakableGroup(5)); - Assert.assertTrue(loadedModel.isPartOfAnUnbreakableGroup(7)); - Assert.assertTrue(loadedModel.isPartOfAnUnbreakableGroup(9)); + assertTrue(loadedModel.isPartOfAnUnbreakableGroup(5)); + assertTrue(loadedModel.isPartOfAnUnbreakableGroup(7)); + assertTrue(loadedModel.isPartOfAnUnbreakableGroup(9)); - Assert.assertEquals(1, loadedModel.getColumnGroupByName("groupB") + assertEquals(1, loadedModel.getColumnGroupByName("groupB") .getStaticColumnIndexes().size()); - Assert.assertEquals(7, loadedModel.getColumnGroupByName("groupB") + assertEquals(7, loadedModel.getColumnGroupByName("groupB") .getStaticColumnIndexes().get(0).intValue()); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupModelTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupModelTest.java index d37085dc..607b546d 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupModelTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupModelTest.java @@ -12,17 +12,17 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; import org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel.ColumnGroup; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnGroupModelTest { @@ -31,7 +31,7 @@ public class ColumnGroupModelTest { public static final String TEST_GROUP_NAME_1 = "testGroupName"; private ColumnGroupModel model; - @Before + @BeforeEach public void setup() { this.model = new ColumnGroupModel(); this.model.addColumnsIndexesToGroup(TEST_GROUP_NAME_1, 0, 1); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupReorderLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupReorderLayerTest.java index 23ca62ff..3b5b5cf4 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupReorderLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupReorderLayerTest.java @@ -13,10 +13,10 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; import java.util.List; @@ -29,8 +29,8 @@ import org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand; import org.eclipse.nebula.widgets.nattable.reorder.command.MultiColumnReorderCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.group.ColumnGroupModelFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.BaseDataLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnGroupReorderLayerTest { @@ -38,7 +38,7 @@ public class ColumnGroupReorderLayerTest { private ColumnGroupModelFixture modelFixture; public ColumnReorderLayer reorderLayer; - @Before + @BeforeEach public void setUp() { this.modelFixture = new ColumnGroupModelFixture(); this.reorderLayer = new ColumnReorderLayer(new BaseDataLayerFixture(24, 20)); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupUtilsTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupUtilsTest.java index 72ffc8f4..c033d813 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupUtilsTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/ColumnGroupUtilsTest.java @@ -12,15 +12,15 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.nebula.widgets.nattable.layer.stack.ColumnGroupBodyLayerStack; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.group.ColumnGroupModelFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnGroupUtilsTest { @@ -34,7 +34,7 @@ public class ColumnGroupUtilsTest { * ------------------------------------------------------------------ |<- G1 * ->| |<-- G2 -->| |<- G4 ->|<--- G3 --->| */ - @Before + @BeforeEach public void setup() { this.model = new ColumnGroupModelFixture(); this.model.addColumnsIndexesToGroup("G4", 8, 9); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/DefaultBodyLayerStackTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/DefaultBodyLayerStackTest.java index 8794916e..9e16713c 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/DefaultBodyLayerStackTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/DefaultBodyLayerStackTest.java @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand; import org.eclipse.nebula.widgets.nattable.hideshow.command.ColumnHideCommand; @@ -25,14 +25,14 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class DefaultBodyLayerStackTest { private DefaultBodyLayerStack layerStack; - @Before + @BeforeEach public void setup() { this.layerStack = new DefaultBodyLayerStack(new DataLayerFixture(10, 5, 100, 20)); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/RowGroupExpandCollapseLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/RowGroupExpandCollapseLayerTest.java index e2ec5623..d4625ec3 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/RowGroupExpandCollapseLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/RowGroupExpandCollapseLayerTest.java @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.data.IRowDataProvider; import org.eclipse.nebula.widgets.nattable.dataset.person.Person; @@ -23,8 +23,8 @@ import org.eclipse.nebula.widgets.nattable.group.model.RowGroup; import org.eclipse.nebula.widgets.nattable.group.model.RowGroupModel; import org.eclipse.nebula.widgets.nattable.hideshow.RowHideShowLayer; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowGroupExpandCollapseLayerTest { @@ -32,7 +32,7 @@ public class RowGroupExpandCollapseLayerTest { private RowHideShowLayer rowHideShowLayer; private RowGroupExpandCollapseLayer<Person> expandCollapseLayer; - @Before + @BeforeEach public void setup() { String[] propertyNames = { "firstName", "lastName", "gender", "married", "birthday" }; IRowDataProvider<Person> bodyDataProvider = diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/RowGroupHeaderLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/RowGroupHeaderLayerTest.java index a4bb50f0..28fd0bd8 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/RowGroupHeaderLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/RowGroupHeaderLayerTest.java @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.ArrayList; import java.util.Date; @@ -54,8 +54,8 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowGroupHeaderLayerTest { @@ -64,7 +64,7 @@ public class RowGroupHeaderLayerTest { private RowGroupModel<Person> rowGroupModel; private GridLayer gridLayer; - @Before + @BeforeEach public void setup() { String[] propertyNames = { "firstName", "lastName", "gender", "married", "birthday" }; diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/action/ColumnGroupReorderDragModeTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/action/ColumnGroupReorderDragModeTest.java index 5be65942..f2991e05 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/action/ColumnGroupReorderDragModeTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/action/ColumnGroupReorderDragModeTest.java @@ -12,13 +12,15 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group.action; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + import org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel; import org.eclipse.nebula.widgets.nattable.layer.ILayer; import org.eclipse.nebula.widgets.nattable.test.fixture.group.ColumnGroupModelFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnGroupReorderDragModeTest { @@ -26,7 +28,7 @@ public class ColumnGroupReorderDragModeTest { private ColumnGroupModel columnGroupModel; private ColumnGroupHeaderReorderDragMode groupReorderDragMode; - @Before + @BeforeEach public void setup() { this.testLayer = new DataLayerFixture(10, 5, 100, 20); this.columnGroupModel = new ColumnGroupModelFixture(); @@ -44,50 +46,50 @@ public class ColumnGroupReorderDragModeTest { @Test public void isValidTargetColumnPositionMovingRight() throws Exception { - Assert.assertTrue(this.groupReorderDragMode.isValidTargetColumnPosition( + assertTrue(this.groupReorderDragMode.isValidTargetColumnPosition( this.testLayer, 0, 0)); - Assert.assertFalse(this.groupReorderDragMode.isValidTargetColumnPosition( + assertFalse(this.groupReorderDragMode.isValidTargetColumnPosition( this.testLayer, 0, 1)); - Assert.assertTrue(this.groupReorderDragMode.isValidTargetColumnPosition( + assertTrue(this.groupReorderDragMode.isValidTargetColumnPosition( this.testLayer, 0, 2)); - Assert.assertFalse(this.groupReorderDragMode.isValidTargetColumnPosition( + assertFalse(this.groupReorderDragMode.isValidTargetColumnPosition( this.testLayer, 0, 3)); - Assert.assertFalse(this.groupReorderDragMode.isValidTargetColumnPosition( + assertFalse(this.groupReorderDragMode.isValidTargetColumnPosition( this.testLayer, 0, 4)); - Assert.assertTrue(this.groupReorderDragMode.isValidTargetColumnPosition( + assertTrue(this.groupReorderDragMode.isValidTargetColumnPosition( this.testLayer, 0, 5)); - Assert.assertTrue(this.groupReorderDragMode.isValidTargetColumnPosition( + assertTrue(this.groupReorderDragMode.isValidTargetColumnPosition( this.testLayer, 0, 6)); } @Test public void isValidTargetColumnPositionMovingLeft() throws Exception { - Assert.assertTrue(this.groupReorderDragMode.isValidTargetColumnPosition( + assertTrue(this.groupReorderDragMode.isValidTargetColumnPosition( this.testLayer, 11, 10)); - Assert.assertTrue(this.groupReorderDragMode.isValidTargetColumnPosition( + assertTrue(this.groupReorderDragMode.isValidTargetColumnPosition( this.testLayer, 11, 9)); - Assert.assertTrue(this.groupReorderDragMode.isValidTargetColumnPosition( + assertTrue(this.groupReorderDragMode.isValidTargetColumnPosition( this.testLayer, 11, 6)); - Assert.assertTrue(this.groupReorderDragMode.isValidTargetColumnPosition( + assertTrue(this.groupReorderDragMode.isValidTargetColumnPosition( this.testLayer, 11, 5)); - Assert.assertFalse(this.groupReorderDragMode.isValidTargetColumnPosition( + assertFalse(this.groupReorderDragMode.isValidTargetColumnPosition( this.testLayer, 11, 4)); - Assert.assertFalse(this.groupReorderDragMode.isValidTargetColumnPosition( + assertFalse(this.groupReorderDragMode.isValidTargetColumnPosition( this.testLayer, 11, 3)); - Assert.assertTrue(this.groupReorderDragMode.isValidTargetColumnPosition( + assertTrue(this.groupReorderDragMode.isValidTargetColumnPosition( this.testLayer, 11, 2)); - Assert.assertFalse(this.groupReorderDragMode.isValidTargetColumnPosition( + assertFalse(this.groupReorderDragMode.isValidTargetColumnPosition( this.testLayer, 11, 1)); // it is allowed to reorder column 11 to 0, because that means to // reorder G3 to the beginning - Assert.assertTrue(this.groupReorderDragMode.isValidTargetColumnPosition( + assertTrue(this.groupReorderDragMode.isValidTargetColumnPosition( this.testLayer, 11, 0)); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/action/ColumnHeaderReoderDragModeTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/action/ColumnHeaderReoderDragModeTest.java index aa467a85..03f341e8 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/action/ColumnHeaderReoderDragModeTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/action/ColumnHeaderReoderDragModeTest.java @@ -12,13 +12,13 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group.action; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.nebula.widgets.nattable.test.fixture.group.ColumnGroupModelFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnHeaderReoderDragModeTest { @@ -26,7 +26,7 @@ public class ColumnHeaderReoderDragModeTest { private ColumnHeaderReorderDragMode dragMode; private DataLayerFixture testLayer; - @Before + @BeforeEach public void setup() { this.model = new ColumnGroupModelFixture(); this.model.addColumnsIndexesToGroup("G4", 18, 19, 20); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/command/ColumnGroupsCommandHandlerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/command/ColumnGroupsCommandHandlerTest.java index db32d146..f803f8cd 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/command/ColumnGroupsCommandHandlerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/command/ColumnGroupsCommandHandlerTest.java @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group.command; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; @@ -31,8 +31,8 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnGroupsCommandHandlerTest { @@ -41,7 +41,7 @@ public class ColumnGroupsCommandHandlerTest { private SelectionLayer selectionLayer; private DefaultGridLayer gridLayer; - @Before + @BeforeEach public void setUp() { this.gridLayer = new GridLayerFixture(); this.selectionLayer = this.gridLayer.getBodyLayer().getSelectionLayer(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnGroupHeaderLayerSelectionTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnGroupHeaderLayerSelectionTest.java index 60c60669..568bc92f 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnGroupHeaderLayerSelectionTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnGroupHeaderLayerSelectionTest.java @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group.performance; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.Serializable; import java.util.ArrayList; @@ -51,8 +51,8 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnGroupHeaderLayerSelectionTest { @@ -68,7 +68,7 @@ public class ColumnGroupHeaderLayerSelectionTest { private LayerListenerFixture layerListener; - @Before + @BeforeEach public void setup() { this.dataProvider = new ListDataProvider<>( getNumberValues(), diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnGroupHeaderLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnGroupHeaderLayerTest.java index 6c0d5f4d..7992e362 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnGroupHeaderLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnGroupHeaderLayerTest.java @@ -12,12 +12,12 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group.performance; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.util.Arrays; import java.util.Collection; @@ -79,8 +79,8 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnGroupHeaderLayerTest { @@ -90,7 +90,7 @@ public class ColumnGroupHeaderLayerTest { SelectionLayer selectionLayer; GridLayer gridLayer; - @Before + @BeforeEach public void setup() { String[] propertyNames = { "firstName", "lastName", "gender", "married", diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnGroupUtilsTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnGroupUtilsTest.java index 94365ed4..78cd4c94 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnGroupUtilsTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnGroupUtilsTest.java @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group.performance; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.HashMap; import java.util.Map; @@ -49,8 +49,8 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnGroupUtilsTest { @@ -58,7 +58,7 @@ public class ColumnGroupUtilsTest { SelectionLayer selectionLayer; GridLayer gridLayer; - @Before + @BeforeEach public void setup() { String[] propertyNames = { "firstName", "lastName", "gender", "married", diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnReorderToggleCommandPositionTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnReorderToggleCommandPositionTest.java index c87decc7..482ada98 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnReorderToggleCommandPositionTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnReorderToggleCommandPositionTest.java @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group.performance; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; @@ -22,7 +22,7 @@ import org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand; import org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderEndCommand; import org.eclipse.nebula.widgets.nattable.reorder.command.MultiColumnReorderCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ColumnReorderToggleCommandPositionTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/GroupHeaderFreezeTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/GroupHeaderFreezeTest.java index f3b6d6a5..0c26c830 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/GroupHeaderFreezeTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/GroupHeaderFreezeTest.java @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group.performance; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.HashMap; import java.util.Map; @@ -56,8 +56,8 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class GroupHeaderFreezeTest { @@ -72,7 +72,7 @@ public class GroupHeaderFreezeTest { SelectionLayer selectionLayer; GridLayer gridLayer; - @Before + @BeforeEach public void setup() { String[] propertyNames = { "firstName", "lastName", "gender", "married", diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/GroupModelTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/GroupModelTest.java index fbfa17e6..47865013 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/GroupModelTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/GroupModelTest.java @@ -12,18 +12,18 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group.performance; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; import java.util.Properties; import org.eclipse.nebula.widgets.nattable.group.performance.GroupModel.Group; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class GroupModelTest { @@ -33,7 +33,7 @@ public class GroupModelTest { private GroupModel model; - @Before + @BeforeEach public void setup() { this.model = new GroupModel(); this.model.addGroup(TEST_GROUP_NAME_1, 0, 4); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/RowGroupHeaderLayerSelectionTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/RowGroupHeaderLayerSelectionTest.java index 45165ae4..9405e8d1 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/RowGroupHeaderLayerSelectionTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/RowGroupHeaderLayerSelectionTest.java @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group.performance; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.Serializable; import java.util.ArrayList; @@ -51,8 +51,8 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowGroupHeaderLayerSelectionTest { @@ -68,7 +68,7 @@ public class RowGroupHeaderLayerSelectionTest { private LayerListenerFixture layerListener; - @Before + @BeforeEach public void setup() { this.dataProvider = new ListDataProvider<>( getNumberValues(), diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/RowGroupHeaderLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/RowGroupHeaderLayerTest.java index ba7cc5e1..aba80912 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/RowGroupHeaderLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/RowGroupHeaderLayerTest.java @@ -12,12 +12,12 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group.performance; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.util.Arrays; import java.util.Collection; @@ -80,8 +80,8 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowGroupHeaderLayerTest { @@ -91,7 +91,7 @@ public class RowGroupHeaderLayerTest { SelectionLayer selectionLayer; GridLayer gridLayer; - @Before + @BeforeEach public void setup() { String[] propertyNames = { "firstName", "lastName", "gender", "married", diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/RowGroupUtilsTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/RowGroupUtilsTest.java index 83d3a9a6..2012658c 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/RowGroupUtilsTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/RowGroupUtilsTest.java @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group.performance; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.HashMap; import java.util.Map; @@ -49,8 +49,8 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowGroupUtilsTest { @@ -58,7 +58,7 @@ public class RowGroupUtilsTest { SelectionLayer selectionLayer; GridLayer gridLayer; - @Before + @BeforeEach public void setup() { String[] propertyNames = { "firstName", "lastName", "gender", "married", diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/RowReorderToggleCommandPositionTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/RowReorderToggleCommandPositionTest.java index d447874d..2f8a8161 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/RowReorderToggleCommandPositionTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/RowReorderToggleCommandPositionTest.java @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group.performance; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; @@ -22,7 +22,7 @@ import org.eclipse.nebula.widgets.nattable.reorder.command.MultiRowReorderComman import org.eclipse.nebula.widgets.nattable.reorder.command.RowReorderCommand; import org.eclipse.nebula.widgets.nattable.reorder.command.RowReorderEndCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class RowReorderToggleCommandPositionTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/TwoLevelColumnGroupHeaderLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/TwoLevelColumnGroupHeaderLayerTest.java index 15c6f4dd..59c91b2c 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/TwoLevelColumnGroupHeaderLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/TwoLevelColumnGroupHeaderLayerTest.java @@ -12,11 +12,11 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group.performance; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; import java.util.HashMap; @@ -69,8 +69,8 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class TwoLevelColumnGroupHeaderLayerTest { @@ -80,7 +80,7 @@ public class TwoLevelColumnGroupHeaderLayerTest { SelectionLayer selectionLayer; GridLayer gridLayer; - @Before + @BeforeEach public void setup() { String[] propertyNames = { "firstName", "lastName", "gender", "married", diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/TwoLevelRowGroupHeaderLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/TwoLevelRowGroupHeaderLayerTest.java index 30878092..422f20d7 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/TwoLevelRowGroupHeaderLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/group/performance/TwoLevelRowGroupHeaderLayerTest.java @@ -12,11 +12,11 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.group.performance; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; import java.util.HashMap; @@ -71,8 +71,8 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class TwoLevelRowGroupHeaderLayerTest { @@ -82,7 +82,7 @@ public class TwoLevelRowGroupHeaderLayerTest { SelectionLayer selectionLayer; GridLayer gridLayer; - @Before + @BeforeEach public void setup() { String[] propertyNames = { "firstName", "lastName", "gender", "married", diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ColumnHideShowLayerPersistenceTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ColumnHideShowLayerPersistenceTest.java index 75d5d57c..637b2dd9 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ColumnHideShowLayerPersistenceTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ColumnHideShowLayerPersistenceTest.java @@ -12,21 +12,21 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.hideshow; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.Arrays; import java.util.Properties; import org.eclipse.nebula.widgets.nattable.grid.data.DummyBodyDataProvider; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnHideShowLayerPersistenceTest { private ColumnHideShowLayer layer; - @Before + @BeforeEach public void setup() { this.layer = new ColumnHideShowLayer(new DataLayer( new DummyBodyDataProvider(10, 10)) { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ColumnHideShowLayerStructuralChangeEventTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ColumnHideShowLayerStructuralChangeEventTest.java index 21128bea..61b7d753 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ColumnHideShowLayerStructuralChangeEventTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ColumnHideShowLayerStructuralChangeEventTest.java @@ -12,7 +12,7 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.hideshow; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.ArrayList; import java.util.Arrays; @@ -25,8 +25,8 @@ import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.layer.IUniqueIndexLayer; import org.eclipse.nebula.widgets.nattable.layer.event.ColumnDeleteEvent; import org.eclipse.nebula.widgets.nattable.layer.event.ColumnInsertEvent; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Test class for testing handling of IStructuralChangeEvents in @@ -41,7 +41,7 @@ public class ColumnHideShowLayerStructuralChangeEventTest { private IUniqueIndexLayer underlyingLayer; private ColumnHideShowLayer columnHideShowLayer; - @Before + @BeforeEach public void setUp() { this.contents = new ArrayList<List<String>>(); this.contents.add(new ArrayList<String>(Arrays.asList("one", "two", "three", diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ColumnHideShowLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ColumnHideShowLayerTest.java index 555268dd..7bb7d33b 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ColumnHideShowLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ColumnHideShowLayerTest.java @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.hideshow; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; import java.util.Collection; @@ -33,14 +33,14 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.data.DataProviderFixture import org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnHideShowLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnHideShowLayerTest { private ColumnHideShowLayer columnHideShowLayer; - @Before + @BeforeEach public void setup() { this.columnHideShowLayer = new ColumnHideShowLayerFixture(); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ColumnHideShowLayerTest2.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ColumnHideShowLayerTest2.java index 59139e8a..79195aff 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ColumnHideShowLayerTest2.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ColumnHideShowLayerTest2.java @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.hideshow; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.util.Arrays; @@ -26,14 +26,14 @@ import org.eclipse.nebula.widgets.nattable.test.LayerAssert; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.TestLayer; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnHideShowLayerTest2 { private ColumnHideShowLayer hideShowLayer; - @Before + @BeforeEach public void setup() { TestLayer dataLayer = new TestLayer(4, 4, "0:0;100 | 1:1;100 | 2:2;100 | 3:3;100", diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ResizeColumnHideShowLayerIntegrationTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ResizeColumnHideShowLayerIntegrationTest.java index 93e5e0e8..50f1ce60 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ResizeColumnHideShowLayerIntegrationTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ResizeColumnHideShowLayerIntegrationTest.java @@ -13,7 +13,7 @@ *****************************************************************************/ package org.eclipse.nebula.widgets.nattable.hideshow; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.Arrays; @@ -39,8 +39,8 @@ import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand; import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ResizeColumnHideShowLayerIntegrationTest { @@ -58,7 +58,7 @@ public class ResizeColumnHideShowLayerIntegrationTest { private FreezeLayer freezeLayer; private CompositeFreezeLayer compositeFreezeLayer; - @Before + @BeforeEach public void setup() { this.bodyDataLayer = new DataLayer(this.bodyDataProvider); this.bodyDataLayer.setColumnPercentageSizing(true); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ResizeColumnHideShowLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ResizeColumnHideShowLayerTest.java index 18b054a1..c8a90b12 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ResizeColumnHideShowLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/ResizeColumnHideShowLayerTest.java @@ -13,10 +13,10 @@ *****************************************************************************/ package org.eclipse.nebula.widgets.nattable.hideshow; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Collection; import java.util.Properties; @@ -38,8 +38,8 @@ import org.eclipse.nebula.widgets.nattable.resize.event.ColumnResizeEvent; import org.eclipse.nebula.widgets.nattable.search.strategy.ISearchStrategy; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ResizeColumnHideShowLayerTest { @@ -55,7 +55,7 @@ public class ResizeColumnHideShowLayerTest { LayerListenerFixture listener; - @Before + @BeforeEach public void setup() { this.reorderLayer = new ColumnReorderLayer(this.bodyDataLayer); this.hideShowLayer = new ResizeColumnHideShowLayer(this.reorderLayer, this.bodyDataLayer); @@ -81,8 +81,8 @@ public class ResizeColumnHideShowLayerTest { assertEquals(0, this.hideShowLayer.getColumnWidthByPosition(1)); assertEquals(0, this.hideShowLayer.getColumnWidthByPosition(4)); assertEquals(2, this.hideShowLayer.getHiddenColumnIndexes().size()); - assertTrue("1 is not contained in hidden column indexes", this.hideShowLayer.getHiddenColumnIndexes().contains(Integer.valueOf(1))); - assertTrue("4 is not contained in hidden column indexes", this.hideShowLayer.getHiddenColumnIndexes().contains(Integer.valueOf(4))); + assertTrue(this.hideShowLayer.getHiddenColumnIndexes().contains(Integer.valueOf(1)), "1 is not contained in hidden column indexes"); + assertTrue(this.hideShowLayer.getHiddenColumnIndexes().contains(Integer.valueOf(4)), "4 is not contained in hidden column indexes"); assertFalse(this.bodyDataLayer.isColumnPositionResizable(1)); assertFalse(this.bodyDataLayer.isColumnPositionResizable(4)); @@ -96,7 +96,7 @@ public class ResizeColumnHideShowLayerTest { assertEquals(500, this.hideShowLayer.getWidth()); assertEquals(100, this.hideShowLayer.getColumnWidthByPosition(1)); assertEquals(100, this.hideShowLayer.getColumnWidthByPosition(4)); - assertTrue("hidden column indexes are not empty", this.hideShowLayer.getHiddenColumnIndexes().isEmpty()); + assertTrue(this.hideShowLayer.getHiddenColumnIndexes().isEmpty(), "hidden column indexes are not empty"); assertTrue(this.bodyDataLayer.isColumnPositionResizable(1)); assertTrue(this.bodyDataLayer.isColumnPositionResizable(4)); @@ -302,7 +302,7 @@ public class ResizeColumnHideShowLayerTest { assertEquals(450, this.hideShowLayer.getWidth()); assertEquals(50, this.hideShowLayer.getColumnWidthByPosition(1)); assertEquals(100, this.hideShowLayer.getColumnWidthByPosition(4)); - assertTrue("hidden column indexes are not empty", this.hideShowLayer.getHiddenColumnIndexes().isEmpty()); + assertTrue(this.hideShowLayer.getHiddenColumnIndexes().isEmpty(), "hidden column indexes are not empty"); assertTrue(this.bodyDataLayer.isColumnPositionResizable(1)); assertFalse(this.bodyDataLayer.isColumnPositionResizable(4)); @@ -314,8 +314,8 @@ public class ResizeColumnHideShowLayerTest { assertEquals(0, this.hideShowLayer.getColumnWidthByPosition(1)); assertEquals(0, this.hideShowLayer.getColumnWidthByPosition(4)); assertEquals(2, this.hideShowLayer.getHiddenColumnIndexes().size()); - assertTrue("1 is not contained in hidden column indexes", this.hideShowLayer.getHiddenColumnIndexes().contains(Integer.valueOf(1))); - assertTrue("4 is not contained in hidden column indexes", this.hideShowLayer.getHiddenColumnIndexes().contains(Integer.valueOf(4))); + assertTrue(this.hideShowLayer.getHiddenColumnIndexes().contains(Integer.valueOf(1)), "1 is not contained in hidden column indexes"); + assertTrue(this.hideShowLayer.getHiddenColumnIndexes().contains(Integer.valueOf(4)), "4 is not contained in hidden column indexes"); assertFalse(this.bodyDataLayer.isColumnPositionResizable(1)); assertFalse(this.bodyDataLayer.isColumnPositionResizable(4)); @@ -327,7 +327,7 @@ public class ResizeColumnHideShowLayerTest { assertEquals(450, this.hideShowLayer.getWidth()); assertEquals(50, this.hideShowLayer.getColumnWidthByPosition(1)); assertEquals(100, this.hideShowLayer.getColumnWidthByPosition(4)); - assertTrue("hidden column indexes are not empty", this.hideShowLayer.getHiddenColumnIndexes().isEmpty()); + assertTrue(this.hideShowLayer.getHiddenColumnIndexes().isEmpty(), "hidden column indexes are not empty"); assertTrue(this.bodyDataLayer.isColumnPositionResizable(1)); assertFalse(this.bodyDataLayer.isColumnPositionResizable(4)); @@ -363,8 +363,8 @@ public class ResizeColumnHideShowLayerTest { assertEquals(0, this.hideShowLayer.getColumnWidthByPosition(4)); assertEquals(2, this.hideShowLayer.getHiddenColumnIndexes().size()); - assertTrue("1 is not contained in hidden column indexes", this.hideShowLayer.getHiddenColumnIndexes().contains(Integer.valueOf(1))); - assertTrue("4 is not contained in hidden column indexes", this.hideShowLayer.getHiddenColumnIndexes().contains(Integer.valueOf(4))); + assertTrue(this.hideShowLayer.getHiddenColumnIndexes().contains(Integer.valueOf(1)), "1 is not contained in hidden column indexes"); + assertTrue(this.hideShowLayer.getHiddenColumnIndexes().contains(Integer.valueOf(4)), "4 is not contained in hidden column indexes"); // save the state Properties hiddenState = new Properties(); @@ -379,7 +379,7 @@ public class ResizeColumnHideShowLayerTest { assertEquals(120, this.hideShowLayer.getColumnWidthByPosition(2)); assertEquals(120, this.hideShowLayer.getColumnWidthByPosition(3)); assertEquals(120, this.hideShowLayer.getColumnWidthByPosition(4)); - assertTrue("hidden column indexes are not empty", this.hideShowLayer.getHiddenColumnIndexes().isEmpty()); + assertTrue(this.hideShowLayer.getHiddenColumnIndexes().isEmpty(), "hidden column indexes are not empty"); this.hideShowLayer.loadState("hidden", hiddenState); @@ -391,8 +391,8 @@ public class ResizeColumnHideShowLayerTest { assertEquals(0, this.hideShowLayer.getColumnWidthByPosition(4)); assertEquals(2, this.hideShowLayer.getHiddenColumnIndexes().size()); - assertTrue("1 is not contained in hidden column indexes", this.hideShowLayer.getHiddenColumnIndexes().contains(Integer.valueOf(1))); - assertTrue("4 is not contained in hidden column indexes", this.hideShowLayer.getHiddenColumnIndexes().contains(Integer.valueOf(4))); + assertTrue(this.hideShowLayer.getHiddenColumnIndexes().contains(Integer.valueOf(1)), "1 is not contained in hidden column indexes"); + assertTrue(this.hideShowLayer.getHiddenColumnIndexes().contains(Integer.valueOf(4)), "4 is not contained in hidden column indexes"); } // test hide with mixed sized where last column @@ -1036,18 +1036,18 @@ public class ResizeColumnHideShowLayerTest { @Test public void testHiddenColumnsHaveSkipSearchLabel() { LabelStack labels = this.hideShowLayer.getConfigLabelsByPosition(1, 0); - assertTrue("LabelStack not empty", labels.isEmpty()); + assertTrue(labels.isEmpty(), "LabelStack not empty"); this.hideShowLayer.hideColumnPositions(1, 4); labels = this.hideShowLayer.getConfigLabelsByPosition(1, 0); - assertFalse("LabelStack not empty", labels.isEmpty()); - assertTrue("skip search label not contained", labels.hasLabel(ISearchStrategy.SKIP_SEARCH_RESULT_LABEL)); + assertFalse(labels.isEmpty(), "LabelStack not empty"); + assertTrue(labels.hasLabel(ISearchStrategy.SKIP_SEARCH_RESULT_LABEL), "skip search label not contained"); this.hideShowLayer.showAllColumns(); labels = this.hideShowLayer.getConfigLabelsByPosition(1, 0); - assertTrue("LabelStack not empty", labels.isEmpty()); + assertTrue(labels.isEmpty(), "LabelStack not empty"); } @Test diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/RowHideShowLayerPersistenceTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/RowHideShowLayerPersistenceTest.java index 46481620..f5035869 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/RowHideShowLayerPersistenceTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/RowHideShowLayerPersistenceTest.java @@ -12,21 +12,21 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.hideshow; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.Arrays; import java.util.Properties; import org.eclipse.nebula.widgets.nattable.grid.data.DummyBodyDataProvider; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowHideShowLayerPersistenceTest { private RowHideShowLayer layer; - @Before + @BeforeEach public void setup() { this.layer = new RowHideShowLayer(new DataLayer(new DummyBodyDataProvider( 10, 10)) { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/RowHideShowLayerStructuralChangeEventTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/RowHideShowLayerStructuralChangeEventTest.java index 2072e05b..63623608 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/RowHideShowLayerStructuralChangeEventTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/RowHideShowLayerStructuralChangeEventTest.java @@ -12,7 +12,7 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.hideshow; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.ArrayList; import java.util.Arrays; @@ -25,8 +25,8 @@ import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.layer.IUniqueIndexLayer; import org.eclipse.nebula.widgets.nattable.layer.event.RowDeleteEvent; import org.eclipse.nebula.widgets.nattable.layer.event.RowInsertEvent; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Test class for testing handling of IStructuralChangeEvents in @@ -41,7 +41,7 @@ public class RowHideShowLayerStructuralChangeEventTest { private IUniqueIndexLayer underlyingLayer; private RowHideShowLayer rowHideShowLayer; - @Before + @BeforeEach public void setUp() { this.contents = new ArrayList<String>(Arrays.asList("one", "two", "three", "four", "five")); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/RowHideShowLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/RowHideShowLayerTest.java index b613f7d5..013c8112 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/RowHideShowLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/RowHideShowLayerTest.java @@ -12,9 +12,9 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.hideshow; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; import java.util.Collection; @@ -24,14 +24,14 @@ import org.eclipse.nebula.widgets.nattable.hideshow.indicator.HideIndicatorConst import org.eclipse.nebula.widgets.nattable.layer.LabelStack; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.RowHideShowLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowHideShowLayerTest { private RowHideShowLayer rowHideShowLayer; - @Before + @BeforeEach public void setup() { this.rowHideShowLayer = new RowHideShowLayerFixture(); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/RowHideShowLayerTest2.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/RowHideShowLayerTest2.java index df542051..12ef9716 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/RowHideShowLayerTest2.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/RowHideShowLayerTest2.java @@ -12,8 +12,8 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.hideshow; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.coordinate.Range; @@ -25,7 +25,7 @@ import org.eclipse.nebula.widgets.nattable.layer.stack.DummyGridLayerStack; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; import org.eclipse.swt.widgets.Shell; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class RowHideShowLayerTest2 { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/RowIdHideShowLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/RowIdHideShowLayerTest.java index 29e53160..7fbabd06 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/RowIdHideShowLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/RowIdHideShowLayerTest.java @@ -12,9 +12,9 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.hideshow; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.Serializable; import java.util.Arrays; @@ -36,8 +36,8 @@ import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.layer.LabelStack; import org.eclipse.nebula.widgets.nattable.reorder.RowReorderLayer; import org.eclipse.nebula.widgets.nattable.sort.command.SortColumnCommand; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowIdHideShowLayerTest { @@ -50,7 +50,7 @@ public class RowIdHideShowLayerTest { private RowReorderLayer reorderLayer; private RowIdHideShowLayer<Person> rowHideShowLayer; - @Before + @BeforeEach public void setup() { this.bodyDataLayer = new DataLayer(this.bodyDataProvider); this.reorderLayer = new RowReorderLayer(this.bodyDataLayer); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/command/MultiColumnShowCommandTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/command/MultiColumnShowCommandTest.java index b51e77e7..6e34cba1 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/command/MultiColumnShowCommandTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/command/MultiColumnShowCommandTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,16 +12,16 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.hideshow.command; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Collection; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class MultiColumnShowCommandTest { @Test - public void testClone() throws Exception { + public void testClone() { MultiColumnShowCommand command = new MultiColumnShowCommand(3, 6, 9, 12); MultiColumnShowCommand copiedCommand = command.cloneCommand(); @@ -31,28 +31,17 @@ public class MultiColumnShowCommandTest { int[] commandIndexesArray = command.getColumnIndexesArray(); int[] cloneIndexesArray = copiedCommand.getColumnIndexesArray(); - assertTrue("The commands reference the same instance", - command != copiedCommand); - assertTrue("The command collections reference the same instance", - commandIndexes != cloneIndexes); - assertTrue("The cloned command does not contain index 3", - cloneIndexes.contains(3)); - assertTrue("The cloned command does not contain index 6", - cloneIndexes.contains(6)); - assertTrue("The cloned command does not contain index 9", - cloneIndexes.contains(9)); - assertTrue("The cloned command does not contain index 12", - cloneIndexes.contains(12)); - - assertTrue("The command arrays reference the same instance", - commandIndexesArray != cloneIndexesArray); - assertTrue("The cloned command does not contain index 3", - cloneIndexesArray[0] == 3); - assertTrue("The cloned command does not contain index 6", - cloneIndexesArray[1] == 6); - assertTrue("The cloned command does not contain index 9", - cloneIndexesArray[2] == 9); - assertTrue("The cloned command does not contain index 12", - cloneIndexesArray[3] == 12); + assertTrue(command != copiedCommand, "The commands reference the same instance"); + assertTrue(commandIndexes != cloneIndexes, "The command collections reference the same instance"); + assertTrue(cloneIndexes.contains(3), "The cloned command does not contain index 3"); + assertTrue(cloneIndexes.contains(6), "The cloned command does not contain index 6"); + assertTrue(cloneIndexes.contains(9), "The cloned command does not contain index 9"); + assertTrue(cloneIndexes.contains(12), "The cloned command does not contain index 12"); + + assertTrue(commandIndexesArray != cloneIndexesArray, "The command arrays reference the same instance"); + assertTrue(cloneIndexesArray[0] == 3, "The cloned command does not contain index 3"); + assertTrue(cloneIndexesArray[1] == 6, "The cloned command does not contain index 6"); + assertTrue(cloneIndexesArray[2] == 9, "The cloned command does not contain index 9"); + assertTrue(cloneIndexesArray[3] == 12, "The cloned command does not contain index 12"); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/command/MultiRowShowCommandTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/command/MultiRowShowCommandTest.java index a8258ecf..a5aa30e5 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/command/MultiRowShowCommandTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/command/MultiRowShowCommandTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2020 Dirk Fauth and others. + * Copyright (c) 2013, 2022 Dirk Fauth and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,11 +12,11 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.hideshow.command; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Collection; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class MultiRowShowCommandTest { @@ -31,28 +31,17 @@ public class MultiRowShowCommandTest { int[] commandIndexesArray = command.getRowIndexesArray(); int[] cloneIndexesArray = copiedCommand.getRowIndexesArray(); - assertTrue("The commands reference the same instance", - command != copiedCommand); - assertTrue("The command collections reference the same instance", - commandIndexes != cloneIndexes); - assertTrue("The cloned command does not contain index 3", - cloneIndexes.contains(3)); - assertTrue("The cloned command does not contain index 6", - cloneIndexes.contains(6)); - assertTrue("The cloned command does not contain index 9", - cloneIndexes.contains(9)); - assertTrue("The cloned command does not contain index 12", - cloneIndexes.contains(12)); - - assertTrue("The command arrays reference the same instance", - commandIndexesArray != cloneIndexesArray); - assertTrue("The cloned command does not contain index 3", - cloneIndexesArray[0] == 3); - assertTrue("The cloned command does not contain index 6", - cloneIndexesArray[1] == 6); - assertTrue("The cloned command does not contain index 9", - cloneIndexesArray[2] == 9); - assertTrue("The cloned command does not contain index 12", - cloneIndexesArray[3] == 12); + assertTrue(command != copiedCommand, "The commands reference the same instance"); + assertTrue(commandIndexes != cloneIndexes, "The command collections reference the same instance"); + assertTrue(cloneIndexes.contains(3), "The cloned command does not contain index 3"); + assertTrue(cloneIndexes.contains(6), "The cloned command does not contain index 6"); + assertTrue(cloneIndexes.contains(9), "The cloned command does not contain index 9"); + assertTrue(cloneIndexes.contains(12), "The cloned command does not contain index 12"); + + assertTrue(commandIndexesArray != cloneIndexesArray, "The command arrays reference the same instance"); + assertTrue(cloneIndexesArray[0] == 3, "The cloned command does not contain index 3"); + assertTrue(cloneIndexesArray[1] == 6, "The cloned command does not contain index 6"); + assertTrue(cloneIndexesArray[2] == 9, "The cloned command does not contain index 9"); + assertTrue(cloneIndexesArray[3] == 12, "The cloned command does not contain index 12"); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/command/ShowAllColumnsCommandTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/command/ShowAllColumnsCommandTest.java index 24e767cf..8b239eea 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/command/ShowAllColumnsCommandTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/command/ShowAllColumnsCommandTest.java @@ -12,18 +12,18 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.hideshow.command; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnHideShowLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ShowAllColumnsCommandTest { private ColumnHideShowLayer columnHideShowLayer; - @Before + @BeforeEach public void setup() { this.columnHideShowLayer = new ColumnHideShowLayerFixture(); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/command/ShowAllRowsCommandTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/command/ShowAllRowsCommandTest.java index f7294b76..e84f4505 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/command/ShowAllRowsCommandTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/command/ShowAllRowsCommandTest.java @@ -12,18 +12,18 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.hideshow.command; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.hideshow.RowHideShowLayer; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.RowHideShowLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ShowAllRowsCommandTest { private RowHideShowLayer rowHideShowLayer; - @Before + @BeforeEach public void setup() { this.rowHideShowLayer = new RowHideShowLayerFixture(); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/event/HideShowColumnEventTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/event/HideShowColumnEventTest.java index 6c45d269..180a36ad 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/event/HideShowColumnEventTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/event/HideShowColumnEventTest.java @@ -12,10 +12,10 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.hideshow.event; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; import java.util.Iterator; @@ -26,8 +26,8 @@ import org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent; import org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class HideShowColumnEventTest { @@ -35,7 +35,7 @@ public class HideShowColumnEventTest { private ColumnReorderLayer reorderLayer; private ColumnHideShowLayer hideShowLayer; - @Before + @BeforeEach public void setUp() { this.reorderLayer = new ColumnReorderLayer(new DataLayerFixture(100, 40)); this.hideShowLayer = new ColumnHideShowLayer(this.reorderLayer); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/event/HideShowRowEventTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/event/HideShowRowEventTest.java index 7e452af4..984a5999 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/event/HideShowRowEventTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/event/HideShowRowEventTest.java @@ -12,10 +12,10 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.hideshow.event; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; import java.util.Iterator; @@ -26,8 +26,8 @@ import org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent; import org.eclipse.nebula.widgets.nattable.reorder.RowReorderLayer; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class HideShowRowEventTest { @@ -35,7 +35,7 @@ public class HideShowRowEventTest { private RowReorderLayer reorderLayer; private RowHideShowLayer hideShowLayer; - @Before + @BeforeEach public void setUp() { this.reorderLayer = new RowReorderLayer(new DataLayerFixture(100, 40)); this.hideShowLayer = new RowHideShowLayer(this.reorderLayer); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/event/ShowColumnPositionsEventDiffTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/event/ShowColumnPositionsEventDiffTest.java index f6e7e12d..e8f83e45 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/event/ShowColumnPositionsEventDiffTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/event/ShowColumnPositionsEventDiffTest.java @@ -12,11 +12,11 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.hideshow.event; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Collection; import java.util.Iterator; @@ -29,9 +29,9 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; import org.eclipse.swt.graphics.Rectangle; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ShowColumnPositionsEventDiffTest { @@ -40,7 +40,7 @@ public class ShowColumnPositionsEventDiffTest { private ColumnHideShowLayer hideShowLayer; private ViewportLayer viewportLayer; - @Before + @BeforeEach public void before() { this.dataLayer = new DataLayerFixture(20, 20, 100, 40); this.hideShowLayer = new ColumnHideShowLayer(this.dataLayer); @@ -59,7 +59,7 @@ public class ShowColumnPositionsEventDiffTest { this.event = new ShowColumnPositionsEvent(this.dataLayer, 2, 4, 7, 8, 9); } - @After + @AfterEach public void after() { assertTrue(this.event.isHorizontalStructureChanged()); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/event/ShowRowPositionsEventDiffTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/event/ShowRowPositionsEventDiffTest.java index 1383d088..14cb79b4 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/event/ShowRowPositionsEventDiffTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hideshow/event/ShowRowPositionsEventDiffTest.java @@ -12,6 +12,12 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.hideshow.event; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.util.Collection; import java.util.Iterator; @@ -23,10 +29,9 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; import org.eclipse.swt.graphics.Rectangle; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ShowRowPositionsEventDiffTest { @@ -35,7 +40,7 @@ public class ShowRowPositionsEventDiffTest { private RowHideShowLayer hideShowLayer; private ViewportLayer viewportLayer; - @Before + @BeforeEach public void before() { this.dataLayer = new DataLayerFixture(20, 20, 100, 40); this.hideShowLayer = new RowHideShowLayer(this.dataLayer); @@ -54,12 +59,12 @@ public class ShowRowPositionsEventDiffTest { this.event = new ShowRowPositionsEvent(this.dataLayer, 2, 4, 7, 8, 9); } - @After + @AfterEach public void after() { - Assert.assertFalse(this.event.isHorizontalStructureChanged()); + assertFalse(this.event.isHorizontalStructureChanged()); - Assert.assertTrue(this.event.isVerticalStructureChanged()); - Assert.assertNull(this.event.getColumnDiffs()); + assertTrue(this.event.isVerticalStructureChanged()); + assertNull(this.event.getColumnDiffs()); } /** @@ -68,14 +73,14 @@ public class ShowRowPositionsEventDiffTest { @Test public void testColumnDiffs() { Collection<StructuralDiff> rowDiffs = this.event.getRowDiffs(); - Assert.assertNotNull(rowDiffs); - Assert.assertEquals(3, rowDiffs.size()); + assertNotNull(rowDiffs); + assertEquals(3, rowDiffs.size()); Iterator<StructuralDiff> iterator = rowDiffs.iterator(); - Assert.assertEquals(new StructuralDiff(DiffTypeEnum.ADD, + assertEquals(new StructuralDiff(DiffTypeEnum.ADD, new Range(2, 2), new Range(2, 3)), iterator.next()); - Assert.assertEquals(new StructuralDiff(DiffTypeEnum.ADD, + assertEquals(new StructuralDiff(DiffTypeEnum.ADD, new Range(3, 3), new Range(4, 5)), iterator.next()); - Assert.assertEquals(new StructuralDiff(DiffTypeEnum.ADD, + assertEquals(new StructuralDiff(DiffTypeEnum.ADD, new Range(5, 5), new Range(7, 10)), iterator.next()); } @@ -87,27 +92,27 @@ public class ShowRowPositionsEventDiffTest { this.event.convertToLocal(this.hideShowLayer); Collection<StructuralDiff> rowDiffs = this.event.getRowDiffs(); - Assert.assertNotNull(rowDiffs); - Assert.assertEquals(3, rowDiffs.size()); + assertNotNull(rowDiffs); + assertEquals(3, rowDiffs.size()); Iterator<StructuralDiff> iterator = rowDiffs.iterator(); - Assert.assertEquals(new StructuralDiff(DiffTypeEnum.ADD, + assertEquals(new StructuralDiff(DiffTypeEnum.ADD, new Range(2, 2), new Range(2, 3)), iterator.next()); - Assert.assertEquals(new StructuralDiff(DiffTypeEnum.ADD, + assertEquals(new StructuralDiff(DiffTypeEnum.ADD, new Range(3, 3), new Range(4, 5)), iterator.next()); - Assert.assertEquals(new StructuralDiff(DiffTypeEnum.ADD, + assertEquals(new StructuralDiff(DiffTypeEnum.ADD, new Range(5, 5), new Range(7, 10)), iterator.next()); this.event.convertToLocal(this.viewportLayer); rowDiffs = this.event.getRowDiffs(); - Assert.assertNotNull(rowDiffs); - Assert.assertEquals(3, rowDiffs.size()); + assertNotNull(rowDiffs); + assertEquals(3, rowDiffs.size()); iterator = rowDiffs.iterator(); - Assert.assertEquals(new StructuralDiff(DiffTypeEnum.ADD, + assertEquals(new StructuralDiff(DiffTypeEnum.ADD, new Range(0, 0), new Range(0, 1)), iterator.next()); - Assert.assertEquals(new StructuralDiff(DiffTypeEnum.ADD, + assertEquals(new StructuralDiff(DiffTypeEnum.ADD, new Range(1, 1), new Range(2, 3)), iterator.next()); - Assert.assertEquals(new StructuralDiff(DiffTypeEnum.ADD, + assertEquals(new StructuralDiff(DiffTypeEnum.ADD, new Range(3, 3), new Range(5, 8)), iterator.next()); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hierarchical/HierarchicalTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hierarchical/HierarchicalTest.java index f3d4117d..3f21b119 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hierarchical/HierarchicalTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hierarchical/HierarchicalTest.java @@ -13,8 +13,8 @@ *****************************************************************************/ package org.eclipse.nebula.widgets.nattable.hierarchical; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import java.util.ArrayList; import java.util.Arrays; @@ -26,7 +26,7 @@ import org.eclipse.nebula.widgets.nattable.dataset.car.CarService; import org.eclipse.nebula.widgets.nattable.dataset.car.Classification; import org.eclipse.nebula.widgets.nattable.dataset.car.Feedback; import org.eclipse.nebula.widgets.nattable.dataset.car.Motor; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class HierarchicalTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hierarchical/HierarchicalTreeLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hierarchical/HierarchicalTreeLayerTest.java index 5ebaf50b..ce673d7d 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hierarchical/HierarchicalTreeLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hierarchical/HierarchicalTreeLayerTest.java @@ -13,11 +13,11 @@ *****************************************************************************/ package org.eclipse.nebula.widgets.nattable.hierarchical; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.Serializable; import java.util.ArrayList; @@ -80,8 +80,8 @@ import org.eclipse.nebula.widgets.nattable.tree.command.TreeExpandCollapseComman import org.eclipse.nebula.widgets.nattable.tree.command.TreeExpandToLevelCommand; import org.eclipse.nebula.widgets.nattable.tree.config.DefaultTreeLayerConfiguration; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class HierarchicalTreeLayerTest { @@ -96,7 +96,7 @@ public class HierarchicalTreeLayerTest { private LayerListenerFixture layerListener; - @Before + @BeforeEach public void setup() { // de-normalize the object graph without parent structure objects this.data = HierarchicalHelper.deNormalize(CarService.getInput(), false, CarService.getPropertyNamesCompact()); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hierarchical/action/HierarchicalTreeColumnReorderDragModeTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hierarchical/action/HierarchicalTreeColumnReorderDragModeTest.java index a0a3ab69..300be632 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hierarchical/action/HierarchicalTreeColumnReorderDragModeTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/hierarchical/action/HierarchicalTreeColumnReorderDragModeTest.java @@ -13,8 +13,8 @@ *****************************************************************************/ package org.eclipse.nebula.widgets.nattable.hierarchical.action; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; @@ -32,14 +32,14 @@ import org.eclipse.nebula.widgets.nattable.layer.SpanningDataLayer; import org.eclipse.nebula.widgets.nattable.layer.cell.ColumnLabelAccumulator; import org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer; import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class HierarchicalTreeColumnReorderDragModeTest { private HierarchicalTreeLayer treeLayer; - @Before + @BeforeEach public void setup() { // de-normalize the object graph without parent structure objects List<HierarchicalWrapper> data = HierarchicalHelper.deNormalize(CarService.getInput(), false, CarService.getPropertyNamesCompact()); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/AbstractLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/AbstractLayerTest.java index 31002e9f..480d2e15 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/AbstractLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/AbstractLayerTest.java @@ -12,11 +12,12 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.layer; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; @@ -28,16 +29,15 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.command.CommandHandlerFi import org.eclipse.nebula.widgets.nattable.test.fixture.command.LayerCommandFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class AbstractLayerTest { private DataLayerFixture dataLayer; private LayerListenerFixture firstListener; - @Before + @BeforeEach public void setup() { this.dataLayer = new DataLayerFixture(); @@ -83,7 +83,7 @@ public class AbstractLayerTest { this.dataLayer.registerPersistable(persistable); this.dataLayer.saveState("test_prefix", properties); - Assert.assertTrue(persistable.stateSaved); + assertTrue(persistable.stateSaved); } @Test diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/AbstractLayerTransformTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/AbstractLayerTransformTest.java index f7d8951a..94c1eef6 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/AbstractLayerTransformTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/AbstractLayerTransformTest.java @@ -14,14 +14,14 @@ package org.eclipse.nebula.widgets.nattable.layer; import org.eclipse.nebula.widgets.nattable.test.LayerAssert; import org.eclipse.nebula.widgets.nattable.test.fixture.TestLayer; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class AbstractLayerTransformTest { private ILayer testLayer; - @Before + @BeforeEach public void setup() { String columnInfo = "0:0;100 | 1:1;100 | 2:2;100 | 3:3;100"; String rowInfo = "0:0;40 | 1:1;40 | 2:2;40 | 3:3;40"; diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/CompositeLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/CompositeLayerTest.java index 803f8ebe..b200f700 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/CompositeLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/CompositeLayerTest.java @@ -12,10 +12,10 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.layer; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.ArrayList; import java.util.Collection; @@ -31,8 +31,8 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.layer.ViewportLayerFixtu import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * @see org.eclipse.nebula.widgets.nattable.test.fixture.layer.CompositeLayerFixture @@ -42,7 +42,7 @@ public class CompositeLayerTest { private CompositeLayerFixture layerFixture; - @Before + @BeforeEach public void setup() { this.layerFixture = new CompositeLayerFixture(); this.layerFixture.bodyLayer.setClientAreaProvider(new IClientAreaProvider() { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/DataLayerCommandHandlingTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/DataLayerCommandHandlingTest.java index 5fb75196..3476c5f6 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/DataLayerCommandHandlingTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/DataLayerCommandHandlingTest.java @@ -12,15 +12,15 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.layer; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.nebula.widgets.nattable.edit.command.UpdateDataCommand; import org.eclipse.nebula.widgets.nattable.layer.event.CellVisualChangeEvent; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class DataLayerCommandHandlingTest { @@ -29,7 +29,7 @@ public class DataLayerCommandHandlingTest { private DataLayer dataLayer; private UpdateDataCommand command; - @Before + @BeforeEach public void setup() { this.dataLayer = new DataLayerFixture(); this.command = new UpdateDataCommand(this.dataLayer, 2, 2, TEST_VALUE); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/DataLayerPersistenceTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/DataLayerPersistenceTest.java index c17dfd76..20441e0b 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/DataLayerPersistenceTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/DataLayerPersistenceTest.java @@ -12,23 +12,23 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.layer; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Properties; import org.eclipse.nebula.widgets.nattable.grid.data.DummyBodyDataProvider; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class DataLayerPersistenceTest { private DataLayer dataLayer; - @Before + @BeforeEach public void setup() { this.dataLayer = new DataLayer(new DummyBodyDataProvider(10, 10)); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/DataLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/DataLayerTest.java index c082c6ff..28181567 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/DataLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/DataLayerTest.java @@ -12,19 +12,19 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.layer; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class DataLayerTest { private DataLayer dataLayer; - @Before + @BeforeEach public void setup() { this.dataLayer = new DataLayerFixture(); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/DpiConverterTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/DpiConverterTest.java index ff702ded..1bc3b30e 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/DpiConverterTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/DpiConverterTest.java @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.layer; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DpiConverterTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/LabelStackTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/LabelStackTest.java index 3bb07636..9dcd48e4 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/LabelStackTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/LabelStackTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020 Dirk Fauth. + * Copyright (c) 2020, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,13 +12,13 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.layer; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Iterator; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class LabelStackTest { @@ -26,9 +26,9 @@ public class LabelStackTest { public void shouldCorrectlyInitializeLabelStack() { LabelStack labels = new LabelStack("One", "Two", "Three"); - assertTrue("One is not contained", labels.hasLabel("One")); - assertTrue("Two is not contained", labels.hasLabel("Two")); - assertTrue("Three is not contained", labels.hasLabel("Three")); + assertTrue(labels.hasLabel("One"), "One is not contained"); + assertTrue(labels.hasLabel("Two"), "Two is not contained"); + assertTrue(labels.hasLabel("Three"), "Three is not contained"); Iterator<String> iterator = labels.iterator(); assertEquals("One", iterator.next()); @@ -43,9 +43,9 @@ public class LabelStackTest { labels.add("Two"); labels.add("Three"); - assertTrue("One is not contained", labels.hasLabel("One")); - assertTrue("Two is not contained", labels.hasLabel("Two")); - assertTrue("Three is not contained", labels.hasLabel("Three")); + assertTrue(labels.hasLabel("One"), "One is not contained"); + assertTrue(labels.hasLabel("Two"), "Two is not contained"); + assertTrue(labels.hasLabel("Three"), "Three is not contained"); Iterator<String> iterator = labels.iterator(); assertEquals("One", iterator.next()); @@ -57,7 +57,7 @@ public class LabelStackTest { public void shouldNotAddLabelsTwiceToLabelStack() { LabelStack labels = new LabelStack("One", "Two", "Three"); - assertFalse("One was added twice", labels.addLabel("One")); + assertFalse(labels.addLabel("One"), "One was added twice"); assertEquals(3, labels.size()); Iterator<String> iterator = labels.iterator(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/LayerUtilTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/LayerUtilTest.java index 831a503c..a34e6619 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/LayerUtilTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/LayerUtilTest.java @@ -12,17 +12,17 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.layer; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class LayerUtilTest { private ILayer layer; - @Before + @BeforeEach public void setup() { this.layer = new DataLayerFixture(); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/SizeConfigPercentageTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/SizeConfigPercentageTest.java index 590d776b..8a029d89 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/SizeConfigPercentageTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/SizeConfigPercentageTest.java @@ -12,10 +12,10 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.layer; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class SizeConfigPercentageTest { @@ -25,7 +25,7 @@ public class SizeConfigPercentageTest { private SizeConfig sizeConfigMixedPercentageMode; private SizeConfig sizeConfigMixedMode; - @Before + @BeforeEach public void setup() { this.sizeConfigCalculationMode = new SizeConfig(DEFAULT_SIZE); this.sizeConfigCalculationMode.setPercentageSizing(true); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/SizeConfigPersistenceTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/SizeConfigPersistenceTest.java index 1c2dd9f3..ad728a65 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/SizeConfigPersistenceTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/SizeConfigPersistenceTest.java @@ -12,21 +12,21 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.layer; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Properties; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class SizeConfigPersistenceTest { private static final int DEFAULT_SIZE = 100; private SizeConfig sizeConfig; - @Before + @BeforeEach public void setup() { this.sizeConfig = new SizeConfig(DEFAULT_SIZE); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/SizeConfigResizeTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/SizeConfigResizeTest.java index 25c3601a..4ef69d52 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/SizeConfigResizeTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/SizeConfigResizeTest.java @@ -13,10 +13,10 @@ *****************************************************************************/ package org.eclipse.nebula.widgets.nattable.layer; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class SizeConfigResizeTest { @@ -25,7 +25,7 @@ public class SizeConfigResizeTest { private SizeConfig defaultMinSizeConfig; private SizeConfig noDynamicPercentageSizeConfig; - @Before + @BeforeEach public void setup() { this.sizeConfig = new SizeConfig(DEFAULT_SIZE); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/SizeConfigScalingTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/SizeConfigScalingTest.java index e6ae782f..32199787 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/SizeConfigScalingTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/SizeConfigScalingTest.java @@ -12,20 +12,20 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.layer; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.nebula.widgets.nattable.util.GUIHelper; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class SizeConfigScalingTest { private static final int DEFAULT_SIZE = 100; private SizeConfig sizeConfig; - @Before + @BeforeEach public void setup() { this.sizeConfig = new SizeConfig(DEFAULT_SIZE); // use dpi of 144 which will result in a dpi factor of 1.5 diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/SizeConfigTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/SizeConfigTest.java index e65f7550..93b25736 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/SizeConfigTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/SizeConfigTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,37 +12,37 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.layer; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class SizeConfigTest { private static final int DEFAULT_SIZE = 100; private SizeConfig sizeConfig; - @Before + @BeforeEach public void setup() { this.sizeConfig = new SizeConfig(DEFAULT_SIZE); } @Test - public void getAggregateSize() throws Exception { + public void getAggregateSize() { assertEquals(1000, this.sizeConfig.getAggregateSize(10)); } @Test - public void sizeOverride() throws Exception { + public void sizeOverride() { this.sizeConfig.setSize(5, 120); assertEquals(120, this.sizeConfig.getSize(5)); } @Test - public void getAggregateSizeWithSizeOverrides() throws Exception { + public void getAggregateSizeWithSizeOverrides() { this.sizeConfig.setSize(5, 120); this.sizeConfig.setSize(0, 10); @@ -52,7 +52,7 @@ public class SizeConfigTest { } @Test - public void setIndexResizable() throws Exception { + public void setIndexResizable() { this.sizeConfig.setResizableByDefault(false); this.sizeConfig.setPositionResizable(2, true); this.sizeConfig.setSize(2, 120); @@ -61,7 +61,7 @@ public class SizeConfigTest { } @Test - public void ingnoreResizeForNonResizableColumns() throws Exception { + public void ingnoreResizeForNonResizableColumns() { this.sizeConfig.setResizableByDefault(false); this.sizeConfig.setSize(2, 120); @@ -69,7 +69,7 @@ public class SizeConfigTest { } @Test - public void allIndexesSameSize() throws Exception { + public void allIndexesSameSize() { assertTrue(this.sizeConfig.isAllPositionsSameSize()); this.sizeConfig.setSize(2, 120); @@ -164,6 +164,6 @@ public class SizeConfigTest { int aggregateSize = sc.getAggregateSize(nCols - 1); - assertTrue("aggregate size of last column is same as cached aggregate size", aggregateSize != cachedAggregateSize); + assertTrue(aggregateSize != cachedAggregateSize, "aggregate size of last column is same as cached aggregate size"); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/cell/ColumnOverrideLabelAccumulatorTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/cell/ColumnOverrideLabelAccumulatorTest.java index d55f1aad..afa1a92b 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/cell/ColumnOverrideLabelAccumulatorTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/cell/ColumnOverrideLabelAccumulatorTest.java @@ -13,7 +13,7 @@ package org.eclipse.nebula.widgets.nattable.layer.cell; import static org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator.PERSISTENCE_KEY; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.ArrayList; import java.util.List; @@ -21,8 +21,8 @@ import java.util.Properties; import org.eclipse.nebula.widgets.nattable.layer.LabelStack; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnOverrideLabelAccumulatorTest { @@ -37,7 +37,7 @@ public class ColumnOverrideLabelAccumulatorTest { private ColumnOverrideLabelAccumulator labelAccumulator; private Properties testProperties; - @Before + @BeforeEach public void setUp() { this.labelAccumulator = new ColumnOverrideLabelAccumulator(new DataLayerFixture()); this.testProperties = new Properties(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/cell/ConfigLabelProviderTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/cell/ConfigLabelProviderTest.java index 3027caaf..4d61f3b9 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/cell/ConfigLabelProviderTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/layer/cell/ConfigLabelProviderTest.java @@ -13,8 +13,8 @@ *****************************************************************************/ package org.eclipse.nebula.widgets.nattable.layer.cell; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.Serializable; import java.util.Collection; @@ -59,7 +59,7 @@ import org.eclipse.nebula.widgets.nattable.tree.ITreeData; import org.eclipse.nebula.widgets.nattable.tree.TreeLayer; import org.eclipse.nebula.widgets.nattable.tree.TreeRowModel; import org.eclipse.nebula.widgets.nattable.tree.config.DefaultTreeLayerConfiguration; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ConfigLabelProviderTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/painter/cell/BoxingStyleTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/painter/cell/BoxingStyleTest.java index 1379b6b1..828b6fe0 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/painter/cell/BoxingStyleTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/painter/cell/BoxingStyleTest.java @@ -12,6 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.painter.cell; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes; import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry; @@ -33,10 +36,9 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.widgets.Display; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class BoxingStyleTest { @@ -47,7 +49,7 @@ public class BoxingStyleTest { private TextPainter cellPainter; private GC gc; - @Before + @BeforeEach public void setUp() throws Exception { this.natTable = new NatTableFixture(); this.configRegistry = (ConfigRegistry) this.natTable.getConfigRegistry(); @@ -57,7 +59,7 @@ public class BoxingStyleTest { this.gc = new GC(Display.getDefault()); } - @After + @AfterEach public void tearDown() { this.gc.dispose(); } @@ -79,12 +81,12 @@ public class BoxingStyleTest { IStyle cellStyle = this.configRegistry.getConfigAttribute( CellConfigAttributes.CELL_STYLE, cell.getDisplayMode(), cell .getConfigLabels()); - Assert.assertEquals(backgroundColor, cellStyle + assertEquals(backgroundColor, cellStyle .getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR)); // set up painter this.cellPainter.setupGCFromConfig(this.gc, cellStyle); - Assert.assertEquals(backgroundColor, this.gc.getBackground()); + assertEquals(backgroundColor, this.gc.getBackground()); } // Foreground color @@ -104,12 +106,12 @@ public class BoxingStyleTest { IStyle cellStyle = this.configRegistry.getConfigAttribute( CellConfigAttributes.CELL_STYLE, cell.getDisplayMode(), cell .getConfigLabels()); - Assert.assertEquals(foregroundColor, cellStyle + assertEquals(foregroundColor, cellStyle .getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR)); // set up painter this.cellPainter.setupGCFromConfig(this.gc, cellStyle); - Assert.assertEquals(foregroundColor, this.gc.getForeground()); + assertEquals(foregroundColor, this.gc.getForeground()); } // Horizontal alignment @@ -125,7 +127,7 @@ public class BoxingStyleTest { // Check cell horizontal alignment ILayerCell cell = this.natTable.getCellByPosition(2, 2); - Assert.assertEquals( + assertEquals( hAlignment.name(), this.configRegistry .getConfigAttribute(CellConfigAttributes.CELL_STYLE, @@ -149,7 +151,7 @@ public class BoxingStyleTest { // Check cell vertical alignment ILayerCell cell = this.natTable.getCellByPosition(2, 3); - Assert.assertEquals( + assertEquals( vAlignment.name(), this.configRegistry .getConfigAttribute(CellConfigAttributes.CELL_STYLE, @@ -201,11 +203,11 @@ public class BoxingStyleTest { ILayerCell cell = natTableFixture.getCellByPosition(columnIndex + ROW_HEADER_COLUMN_COUNT, 2); TextPainter cellPainter = new TextPainter(); - Assert.assertEquals("Automatic", + assertEquals("Automatic", cellPainter.convertDataType(cell, configRegistry)); // Assert that the display value is converted to an Object - Assert.assertTrue(dataValue instanceof PricingTypeBean); + assertTrue(dataValue instanceof PricingTypeBean); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/painter/cell/ButtonCellPainterTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/painter/cell/ButtonCellPainterTest.java index 12ba9094..2f2d0744 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/painter/cell/ButtonCellPainterTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/painter/cell/ButtonCellPainterTest.java @@ -12,6 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.painter.cell; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell; import org.eclipse.nebula.widgets.nattable.layer.cell.LayerCell; import org.eclipse.nebula.widgets.nattable.test.fixture.CellPainterFixture; @@ -21,9 +24,8 @@ import org.eclipse.nebula.widgets.nattable.test.integration.SWTUtils; import org.eclipse.nebula.widgets.nattable.ui.NatEventData; import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.graphics.GC; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ButtonCellPainterTest { @@ -35,7 +37,7 @@ public class ButtonCellPainterTest { private GC gcFixture; private MouseEvent mouseClickEvent; - @Before + @BeforeEach public void setup() { this.buttonRaisedPainter = new CellPainterFixture(); this.buttonPressedPainter = new CellPainterFixture(); @@ -59,8 +61,8 @@ public class ButtonCellPainterTest { this.buttonCellPainter.paintCell(this.cellFixture, this.gcFixture, this.cellFixture.getBounds(), this.natTable.getConfigRegistry()); - Assert.assertTrue(this.buttonRaisedPainter.isPainted()); - Assert.assertFalse(this.buttonPressedPainter.isPainted()); + assertTrue(this.buttonRaisedPainter.isPainted()); + assertFalse(this.buttonPressedPainter.isPainted()); // Mouse clicked this.buttonCellPainter.run(this.natTable, this.mouseClickEvent); @@ -68,7 +70,7 @@ public class ButtonCellPainterTest { this.cellFixture.getBounds(), this.natTable.getConfigRegistry()); // Should be painted in pressed state - Assert.assertTrue(this.buttonPressedPainter.isPainted()); + assertTrue(this.buttonPressedPainter.isPainted()); } @Test @@ -77,12 +79,12 @@ public class ButtonCellPainterTest { this.buttonCellPainter.addClickListener(mouseAction); this.buttonCellPainter.run(this.natTable, this.mouseClickEvent); - Assert.assertTrue(mouseAction.isActionInvoked()); + assertTrue(mouseAction.isActionInvoked()); this.buttonCellPainter.removeClickListener(mouseAction); mouseAction.reset(); this.buttonCellPainter.run(this.natTable, this.mouseClickEvent); - Assert.assertFalse(mouseAction.isActionInvoked()); + assertFalse(mouseAction.isActionInvoked()); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/painter/cell/ConfigurableCellBorderTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/painter/cell/ConfigurableCellBorderTest.java index 2e435c63..7aae146f 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/painter/cell/ConfigurableCellBorderTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/painter/cell/ConfigurableCellBorderTest.java @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.painter.cell; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes; @@ -27,15 +27,15 @@ import org.eclipse.nebula.widgets.nattable.style.SelectionStyleLabels; import org.eclipse.nebula.widgets.nattable.style.Style; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.nebula.widgets.nattable.util.GUIHelper; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ConfigurableCellBorderTest { private NatTable natTable; private ConfigRegistry configRegistry; - @Before + @BeforeEach public void setUp() throws Exception { this.natTable = new NatTableFixture(); this.configRegistry = (ConfigRegistry) this.natTable.getConfigRegistry(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/painter/cell/TextRenderingTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/painter/cell/TextRenderingTest.java index 3849d660..b6e72311 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/painter/cell/TextRenderingTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/painter/cell/TextRenderingTest.java @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.painter.cell; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -34,9 +34,9 @@ import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.widgets.Display; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class TextRenderingTest { @@ -46,7 +46,7 @@ public class TextRenderingTest { private GC gc; private Font defaultFont; - @Before + @BeforeEach public void setUp() throws Exception { this.natTable = new NatTableFixture(); this.configRegistry = (ConfigRegistry) this.natTable.getConfigRegistry(); @@ -55,7 +55,7 @@ public class TextRenderingTest { this.gc = new GC(Display.getDefault()); } - @After + @AfterEach public void tearDown() { if (this.defaultFont != null) { this.defaultFont.dispose(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/paste/NatTableBulkUpdateSupportTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/paste/NatTableBulkUpdateSupportTest.java index a9f68175..50dd161c 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/paste/NatTableBulkUpdateSupportTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/paste/NatTableBulkUpdateSupportTest.java @@ -12,8 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.paste; -import org.junit.Assert; -import org.junit.Test; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; //TODO -- Uncomment and enable tests so when we figure out how to make cglib work. public class NatTableBulkUpdateSupportTest { @@ -22,7 +23,7 @@ public class NatTableBulkUpdateSupportTest { // private DataUpdateHelper<PricingDataBean> helper; // private List<Serializable> rowIds; // - // @Before + // @BeforeEach // public void init() { // ContentConfigRegistry contentConfigRegistry = new // ContentConfigRegistry(); @@ -88,6 +89,6 @@ public class NatTableBulkUpdateSupportTest { @Test public void dummyTest() { - Assert.assertTrue(true); + assertTrue(true); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/persistence/BorderStylePersistenceTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/persistence/BorderStylePersistenceTest.java index 327031bf..4d21046b 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/persistence/BorderStylePersistenceTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/persistence/BorderStylePersistenceTest.java @@ -13,12 +13,12 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.persistence; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.style.BorderStyle; import org.eclipse.nebula.widgets.nattable.style.BorderStyle.BorderModeEnum; import org.eclipse.nebula.widgets.nattable.style.BorderStyle.LineStyleEnum; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class BorderStylePersistenceTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/persistence/ColorPersistorTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/persistence/ColorPersistorTest.java index 371b2c8a..25af2c67 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/persistence/ColorPersistorTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/persistence/ColorPersistorTest.java @@ -12,23 +12,23 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.persistence; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import java.util.Properties; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.widgets.Display; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColorPersistorTest { private static final Color TEST_COLOR = Display.getDefault().getSystemColor(SWT.COLOR_RED); Properties properties; - @Before + @BeforeEach public void setup() { this.properties = new Properties(); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/persistence/PersistenceHelperTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/persistence/PersistenceHelperTest.java index 824ea8bf..524f7b37 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/persistence/PersistenceHelperTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/persistence/PersistenceHelperTest.java @@ -12,15 +12,15 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.persistence; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Collection; import java.util.Properties; import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PersistenceHelperTest { @@ -35,26 +35,28 @@ public class PersistenceHelperTest { Collection<String> stateNames = PersistenceHelper.getAvailableStates(properties); assertTrue( - "Resulting state name collection does not contain the empty default state", - stateNames.contains("")); + stateNames.contains(""), + "Resulting state name collection does not contain the empty default state"); assertTrue( - "Resulting state name collection does not contain the 'Blubb' state", - stateNames.contains("Blubb")); + stateNames.contains("Blubb"), + "Resulting state name collection does not contain the 'Blubb' state"); assertTrue( - "Resulting state name collection does not contain the 'Temp' state", - stateNames.contains("Temp")); + stateNames.contains("Temp"), + "Resulting state name collection does not contain the 'Temp' state"); } @Test public void testGetAvailableStatesOnNull() { - assertTrue("Resulting state name collection is not empty", - PersistenceHelper.getAvailableStates(null).isEmpty()); + assertTrue( + PersistenceHelper.getAvailableStates(null).isEmpty(), + "Resulting state name collection is not empty"); } @Test public void testGetAvailableStatesOnEmpty() { - assertTrue("Resulting state name collection is not empty", - PersistenceHelper.getAvailableStates(new Properties()).isEmpty()); + assertTrue( + PersistenceHelper.getAvailableStates(new Properties()).isEmpty(), + "Resulting state name collection is not empty"); } @Test @@ -68,27 +70,27 @@ public class PersistenceHelperTest { Collection<String> stateNames = PersistenceHelper.getAvailableStates(properties); assertTrue( - "Resulting state name collection does not contain the empty default state", - stateNames.contains("")); + stateNames.contains(""), + "Resulting state name collection does not contain the empty default state"); assertTrue( - "Resulting state name collection does not contain the 'Blubb' state", - stateNames.contains("Blubb")); + stateNames.contains("Blubb"), + "Resulting state name collection does not contain the 'Blubb' state"); assertTrue( - "Resulting state name collection does not contain the 'Temp' state", - stateNames.contains("Temp")); + stateNames.contains("Temp"), + "Resulting state name collection does not contain the 'Temp' state"); PersistenceHelper.deleteState("Blubb", properties); stateNames = PersistenceHelper.getAvailableStates(properties); assertTrue( - "Resulting state name collection does not contain the empty default state", - stateNames.contains("")); + stateNames.contains(""), + "Resulting state name collection does not contain the empty default state"); assertFalse( - "Resulting state name collection does not contain the 'Blubb' state", - stateNames.contains("Blubb")); + stateNames.contains("Blubb"), + "Resulting state name collection does not contain the 'Blubb' state"); assertTrue( - "Resulting state name collection does not contain the 'Temp' state", - stateNames.contains("Temp")); + stateNames.contains("Temp"), + "Resulting state name collection does not contain the 'Temp' state"); } @Test @@ -102,28 +104,28 @@ public class PersistenceHelperTest { Collection<String> stateNames = PersistenceHelper.getAvailableStates(properties); assertTrue( - "Resulting state name collection does not contain the empty default state", - stateNames.contains("")); + stateNames.contains(""), + "Resulting state name collection does not contain the empty default state"); assertTrue( - "Resulting state name collection does not contain the 'Blubb' state", - stateNames.contains("Blubb")); + stateNames.contains("Blubb"), + "Resulting state name collection does not contain the 'Blubb' state"); assertTrue( - "Resulting state name collection does not contain the 'Temp' state", - stateNames.contains("Temp")); + stateNames.contains("Temp"), + "Resulting state name collection does not contain the 'Temp' state"); PersistenceHelper.deleteState("Blubb", null); // no impact stateNames = PersistenceHelper.getAvailableStates(properties); assertTrue( - "Resulting state name collection does not contain the empty default state", - stateNames.contains("")); + stateNames.contains(""), + "Resulting state name collection does not contain the empty default state"); assertTrue( - "Resulting state name collection does not contain the 'Blubb' state", - stateNames.contains("Blubb")); + stateNames.contains("Blubb"), + "Resulting state name collection does not contain the 'Blubb' state"); assertTrue( - "Resulting state name collection does not contain the 'Temp' state", - stateNames.contains("Temp")); + stateNames.contains("Temp"), + "Resulting state name collection does not contain the 'Temp' state"); } @Test @@ -137,28 +139,28 @@ public class PersistenceHelperTest { Collection<String> stateNames = PersistenceHelper.getAvailableStates(properties); assertTrue( - "Resulting state name collection does not contain the empty default state", - stateNames.contains("")); + stateNames.contains(""), + "Resulting state name collection does not contain the empty default state"); assertTrue( - "Resulting state name collection does not contain the 'Blubb' state", - stateNames.contains("Blubb")); + stateNames.contains("Blubb"), + "Resulting state name collection does not contain the 'Blubb' state"); assertTrue( - "Resulting state name collection does not contain the 'Temp' state", - stateNames.contains("Temp")); + stateNames.contains("Temp"), + "Resulting state name collection does not contain the 'Temp' state"); PersistenceHelper.deleteState(null, properties); // no impact stateNames = PersistenceHelper.getAvailableStates(properties); assertTrue( - "Resulting state name collection does not contain the empty default state", - stateNames.contains("")); + stateNames.contains(""), + "Resulting state name collection does not contain the empty default state"); assertTrue( - "Resulting state name collection does not contain the 'Blubb' state", - stateNames.contains("Blubb")); + stateNames.contains("Blubb"), + "Resulting state name collection does not contain the 'Blubb' state"); assertTrue( - "Resulting state name collection does not contain the 'Temp' state", - stateNames.contains("Temp")); + stateNames.contains("Temp"), + "Resulting state name collection does not contain the 'Temp' state"); } @Test @@ -172,28 +174,28 @@ public class PersistenceHelperTest { Collection<String> stateNames = PersistenceHelper.getAvailableStates(properties); assertTrue( - "Resulting state name collection does not contain the empty default state", - stateNames.contains("")); + stateNames.contains(""), + "Resulting state name collection does not contain the empty default state"); assertTrue( - "Resulting state name collection does not contain the 'Blubb' state", - stateNames.contains("Blubb")); + stateNames.contains("Blubb"), + "Resulting state name collection does not contain the 'Blubb' state"); assertTrue( - "Resulting state name collection does not contain the 'Temp' state", - stateNames.contains("Temp")); + stateNames.contains("Temp"), + "Resulting state name collection does not contain the 'Temp' state"); PersistenceHelper.deleteState("Blubb", new Properties()); // no impact stateNames = PersistenceHelper.getAvailableStates(properties); assertTrue( - "Resulting state name collection does not contain the empty default state", - stateNames.contains("")); + stateNames.contains(""), + "Resulting state name collection does not contain the empty default state"); assertTrue( - "Resulting state name collection does not contain the 'Blubb' state", - stateNames.contains("Blubb")); + stateNames.contains("Blubb"), + "Resulting state name collection does not contain the 'Blubb' state"); assertTrue( - "Resulting state name collection does not contain the 'Temp' state", - stateNames.contains("Temp")); + stateNames.contains("Temp"), + "Resulting state name collection does not contain the 'Temp' state"); } @Test @@ -207,27 +209,27 @@ public class PersistenceHelperTest { Collection<String> stateNames = PersistenceHelper.getAvailableStates(properties); assertTrue( - "Resulting state name collection does not contain the empty default state", - stateNames.contains("")); + stateNames.contains(""), + "Resulting state name collection does not contain the empty default state"); assertTrue( - "Resulting state name collection does not contain the 'Blubb' state", - stateNames.contains("Blubb")); + stateNames.contains("Blubb"), + "Resulting state name collection does not contain the 'Blubb' state"); assertTrue( - "Resulting state name collection does not contain the 'Temp' state", - stateNames.contains("Temp")); + stateNames.contains("Temp"), + "Resulting state name collection does not contain the 'Temp' state"); PersistenceHelper.deleteState("", properties); // no impact stateNames = PersistenceHelper.getAvailableStates(properties); assertFalse( - "Resulting state name collection does not contain the empty default state", - stateNames.contains("")); + stateNames.contains(""), + "Resulting state name collection does not contain the empty default state"); assertTrue( - "Resulting state name collection does not contain the 'Blubb' state", - stateNames.contains("Blubb")); + stateNames.contains("Blubb"), + "Resulting state name collection does not contain the 'Blubb' state"); assertTrue( - "Resulting state name collection does not contain the 'Temp' state", - stateNames.contains("Temp")); + stateNames.contains("Temp"), + "Resulting state name collection does not contain the 'Temp' state"); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/persistence/StylePersistorTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/persistence/StylePersistorTest.java index 86c5df76..007fcd46 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/persistence/StylePersistorTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/persistence/StylePersistorTest.java @@ -22,8 +22,8 @@ import static org.eclipse.nebula.widgets.nattable.persistence.StylePersistor.STY import static org.eclipse.nebula.widgets.nattable.persistence.StylePersistor.V_ALIGNMENT_PREFIX; import static org.eclipse.nebula.widgets.nattable.style.CellStyleAttributes.BACKGROUND_COLOR; import static org.eclipse.nebula.widgets.nattable.style.CellStyleAttributes.FOREGROUND_COLOR; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Properties; @@ -38,14 +38,14 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.PropertiesFixture; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.widgets.Display; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class StylePersistorTest { private static final String TEST_PREFIX = "TEST_PREFIX"; private PropertiesFixture propertiesFixture; - @Before + @BeforeEach public void setup() { this.propertiesFixture = new PropertiesFixture() .addStyleProperties(TEST_PREFIX); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/ColumnReorderLayerStructuralChangeEventTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/ColumnReorderLayerStructuralChangeEventTest.java index d8396767..c1d066e1 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/ColumnReorderLayerStructuralChangeEventTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/ColumnReorderLayerStructuralChangeEventTest.java @@ -12,7 +12,7 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.reorder; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.ArrayList; import java.util.Arrays; @@ -25,8 +25,8 @@ import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.layer.IUniqueIndexLayer; import org.eclipse.nebula.widgets.nattable.layer.event.ColumnDeleteEvent; import org.eclipse.nebula.widgets.nattable.layer.event.ColumnInsertEvent; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Test class for testing handling of IStructuralChangeEvents in @@ -41,7 +41,7 @@ public class ColumnReorderLayerStructuralChangeEventTest { private IUniqueIndexLayer underlyingLayer; private ColumnReorderLayer columnReorderLayer; - @Before + @BeforeEach public void setUp() { this.contents = new ArrayList<List<String>>(); this.contents.add(new ArrayList<String>(Arrays.asList("one", "two", "three", diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/ColumnReorderLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/ColumnReorderLayerTest.java index 8df3ced7..fe23dcf2 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/ColumnReorderLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/ColumnReorderLayerTest.java @@ -13,9 +13,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.reorder; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; import java.util.List; @@ -30,16 +30,15 @@ import org.eclipse.nebula.widgets.nattable.reorder.command.ResetColumnReorderCom import org.eclipse.nebula.widgets.nattable.test.fixture.command.LayerCommandFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.BaseDataLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnReorderLayerTest { private IUniqueIndexLayer underlyingLayer; private ColumnReorderLayer columnReorderLayer; - @Before + @BeforeEach public void setUp() { this.underlyingLayer = new BaseDataLayerFixture(4, 4); this.columnReorderLayer = new ColumnReorderLayer(this.underlyingLayer); @@ -74,9 +73,7 @@ public class ColumnReorderLayerTest { @Test /** - * Index 1 2 3 0 - * -------------------- - * Position 0 1 2 3 + * Index 1 2 3 0 -------------------- Position 0 1 2 3 */ public void reorderViewableColumnsLeftToRightByPosition() throws Exception { // Moving to the end @@ -91,9 +88,7 @@ public class ColumnReorderLayerTest { @Test /** - * Index 2 0 1 3 - * -------------------- - * Position 0 1 2 3 + * Index 2 0 1 3 -------------------- Position 0 1 2 3 */ public void reorderMultipleColumnsLeftToRight() throws Exception { this.columnReorderLayer.reorderMultipleColumnPositions(new int[] { 0, 1 }, 3); @@ -106,9 +101,7 @@ public class ColumnReorderLayerTest { @Test /** - * Index 2 3 0 1 - * -------------------- - * Position 0 1 2 3 + * Index 2 3 0 1 -------------------- Position 0 1 2 3 */ public void reorderMultipleColumnsLeftToRightToTheEnd() throws Exception { this.columnReorderLayer.reorderMultipleColumnPositions(new int[] { 0, 1 }, 4); @@ -121,9 +114,7 @@ public class ColumnReorderLayerTest { @Test /** - * Index 0 1 3 2 - * -------------------- - * Position 0 1 2 3 + * Index 0 1 3 2 -------------------- Position 0 1 2 3 */ public void reorderViewableColumnsRightToLeftByPosition() throws Exception { this.columnReorderLayer.reorderColumnPosition(3, 2); @@ -137,9 +128,7 @@ public class ColumnReorderLayerTest { @Test /** - * Index 2 3 0 1 - * -------------------- - * Position 0 1 2 3 + * Index 2 3 0 1 -------------------- Position 0 1 2 3 */ public void reorderMultipleColumnsRightToLeft() throws Exception { List<Integer> fromColumnPositions = Arrays.asList(new Integer[] { 2, 3 }); @@ -154,9 +143,7 @@ public class ColumnReorderLayerTest { @Test /** - * Index 2 3 0 1 ... 20 - * -------------------- - * Position 0 1 2 3 ... 20 + * Index 2 3 0 1 ... 20 -------------------- Position 0 1 2 3 ... 20 */ public void reorderMultipleColumnsLargeArrayToEdges() throws Exception { @@ -220,11 +207,11 @@ public class ColumnReorderLayerTest { this.columnReorderLayer.reorderColumnPosition(0, 5); // 1 2 3 4 0 - Assert.assertEquals(100, this.columnReorderLayer.getColumnWidthByPosition(0)); - Assert.assertEquals(35, this.columnReorderLayer.getColumnWidthByPosition(1)); - Assert.assertEquals(100, this.columnReorderLayer.getColumnWidthByPosition(2)); - Assert.assertEquals(80, this.columnReorderLayer.getColumnWidthByPosition(3)); - Assert.assertEquals(150, this.columnReorderLayer.getColumnWidthByPosition(4)); + assertEquals(100, this.columnReorderLayer.getColumnWidthByPosition(0)); + assertEquals(35, this.columnReorderLayer.getColumnWidthByPosition(1)); + assertEquals(100, this.columnReorderLayer.getColumnWidthByPosition(2)); + assertEquals(80, this.columnReorderLayer.getColumnWidthByPosition(3)); + assertEquals(150, this.columnReorderLayer.getColumnWidthByPosition(4)); } @Test diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/ColumnReorderLayerTest2.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/ColumnReorderLayerTest2.java index f31a6fe2..5428b99e 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/ColumnReorderLayerTest2.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/ColumnReorderLayerTest2.java @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.reorder; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Properties; @@ -21,14 +21,14 @@ import org.eclipse.nebula.widgets.nattable.layer.event.ColumnStructuralRefreshEv import org.eclipse.nebula.widgets.nattable.test.LayerAssert; import org.eclipse.nebula.widgets.nattable.test.fixture.TestLayer; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnReorderLayerTest2 { private ColumnReorderLayer reorderLayer; - @Before + @BeforeEach public void setup() { TestLayer dataLayer = new TestLayer(4, 4, "0:0;100 | 1:1;100 | 2:2;100 | 3:3;100", diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/ColumnReorderLayerVisibleChangeTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/ColumnReorderLayerVisibleChangeTest.java index 8383da41..578c4ec1 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/ColumnReorderLayerVisibleChangeTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/ColumnReorderLayerVisibleChangeTest.java @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.reorder; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.HashSet; @@ -21,7 +21,7 @@ import org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent; import org.eclipse.nebula.widgets.nattable.reorder.event.ColumnReorderEvent; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.BaseDataLayerFixture; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ColumnReorderLayerVisibleChangeTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/RowReorderLayerStructuralChangeEventTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/RowReorderLayerStructuralChangeEventTest.java index e9bee479..7dc59aba 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/RowReorderLayerStructuralChangeEventTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/RowReorderLayerStructuralChangeEventTest.java @@ -12,7 +12,7 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.reorder; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.ArrayList; import java.util.Arrays; @@ -25,8 +25,8 @@ import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.layer.IUniqueIndexLayer; import org.eclipse.nebula.widgets.nattable.layer.event.RowDeleteEvent; import org.eclipse.nebula.widgets.nattable.layer.event.RowInsertEvent; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Test class for testing handling of IStructuralChangeEvents in RowReorderLayer @@ -40,7 +40,7 @@ public class RowReorderLayerStructuralChangeEventTest { private IUniqueIndexLayer underlyingLayer; private RowReorderLayer rowReorderLayer; - @Before + @BeforeEach public void setUp() { this.contents = new ArrayList<String>(Arrays.asList("one", "two", "three", "four")); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/RowReorderLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/RowReorderLayerTest.java index 75fa9ee6..27671860 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/RowReorderLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/RowReorderLayerTest.java @@ -12,9 +12,9 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.reorder; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; import java.util.List; @@ -25,16 +25,15 @@ import org.eclipse.nebula.widgets.nattable.reorder.command.RowReorderCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.command.LayerCommandFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.BaseDataLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowReorderLayerTest { private IUniqueIndexLayer underlyingLayer; private RowReorderLayer rowReorderLayer; - @Before + @BeforeEach public void setUp() { this.underlyingLayer = new BaseDataLayerFixture(4, 4); this.rowReorderLayer = new RowReorderLayer(this.underlyingLayer); @@ -69,9 +68,7 @@ public class RowReorderLayerTest { @Test /** - * Index 1 2 3 0 - * -------------------- - * Position 0 1 2 3 + * Index 1 2 3 0 -------------------- Position 0 1 2 3 */ public void reorderViewableRowsTopToBottomByPosition() throws Exception { // Moving to the end @@ -86,9 +83,7 @@ public class RowReorderLayerTest { @Test /** - * Index 2 0 1 3 - * -------------------- - * Position 0 1 2 3 + * Index 2 0 1 3 -------------------- Position 0 1 2 3 */ public void reorderMultipleRowsTopToBottom() throws Exception { this.rowReorderLayer.reorderMultipleRowPositions(new int[] { 0, 1 }, 3); @@ -101,9 +96,7 @@ public class RowReorderLayerTest { @Test /** - * Index 2 3 0 1 - * -------------------- - * Position 0 1 2 3 + * Index 2 3 0 1 -------------------- Position 0 1 2 3 */ public void reorderMultipleRowsTopToBottomToTheEnd() throws Exception { this.rowReorderLayer.reorderMultipleRowPositions(new int[] { 0, 1 }, 4); @@ -116,9 +109,7 @@ public class RowReorderLayerTest { @Test /** - * Index 0 1 3 2 - * -------------------- - * Position 0 1 2 3 + * Index 0 1 3 2 -------------------- Position 0 1 2 3 */ public void reorderViewableRowsBottomToTopByPosition() throws Exception { this.rowReorderLayer.reorderRowPosition(3, 2); @@ -132,9 +123,7 @@ public class RowReorderLayerTest { @Test /** - * Index 2 3 0 1 - * -------------------- - * Position 0 1 2 3 + * Index 2 3 0 1 -------------------- Position 0 1 2 3 */ public void reorderMultipleRowsBottomToTop() throws Exception { List<Integer> fromRowPositions = Arrays.asList(new Integer[] { 2, 3 }); @@ -149,9 +138,7 @@ public class RowReorderLayerTest { @Test /** - * Index 2 3 0 1 ... 20 - * -------------------- - * Position 0 1 2 3 ... 20 + * Index 2 3 0 1 ... 20 -------------------- Position 0 1 2 3 ... 20 */ public void reorderMultipleRowsLargeArrayToEdges() throws Exception { @@ -214,13 +201,13 @@ public class RowReorderLayerTest { this.rowReorderLayer.reorderRowPosition(0, 7); // 1 2 3 4 0 - Assert.assertEquals(70, this.rowReorderLayer.getRowHeightByPosition(0)); - Assert.assertEquals(25, this.rowReorderLayer.getRowHeightByPosition(1)); - Assert.assertEquals(40, this.rowReorderLayer.getRowHeightByPosition(2)); - Assert.assertEquals(50, this.rowReorderLayer.getRowHeightByPosition(3)); - Assert.assertEquals(40, this.rowReorderLayer.getRowHeightByPosition(4)); - Assert.assertEquals(100, this.rowReorderLayer.getRowHeightByPosition(5)); - Assert.assertEquals(40, this.rowReorderLayer.getRowHeightByPosition(6)); + assertEquals(70, this.rowReorderLayer.getRowHeightByPosition(0)); + assertEquals(25, this.rowReorderLayer.getRowHeightByPosition(1)); + assertEquals(40, this.rowReorderLayer.getRowHeightByPosition(2)); + assertEquals(50, this.rowReorderLayer.getRowHeightByPosition(3)); + assertEquals(40, this.rowReorderLayer.getRowHeightByPosition(4)); + assertEquals(100, this.rowReorderLayer.getRowHeightByPosition(5)); + assertEquals(40, this.rowReorderLayer.getRowHeightByPosition(6)); } @Test diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/RowReorderLayerTest2.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/RowReorderLayerTest2.java index fb15a267..1d96f4da 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/RowReorderLayerTest2.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/RowReorderLayerTest2.java @@ -12,22 +12,22 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.reorder; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Properties; import org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralRefreshEvent; import org.eclipse.nebula.widgets.nattable.test.fixture.TestLayer; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowReorderLayerTest2 { private RowReorderLayer reorderLayer; - @Before + @BeforeEach public void setup() { TestLayer dataLayer = new TestLayer(4, 4, "0:0;100 | 1:1;100 | 2:2;100 | 3:3;100", diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/RowReorderLayerVisibleChangeTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/RowReorderLayerVisibleChangeTest.java index 8307a794..5739ba2f 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/RowReorderLayerVisibleChangeTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/RowReorderLayerVisibleChangeTest.java @@ -12,7 +12,7 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.reorder; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.HashSet; @@ -21,7 +21,7 @@ import org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent; import org.eclipse.nebula.widgets.nattable.reorder.event.RowReorderEvent; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.BaseDataLayerFixture; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class RowReorderLayerVisibleChangeTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/command/ReorderColumnCommandTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/command/ReorderColumnCommandTest.java index 6df3a80b..7efa39b3 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/command/ReorderColumnCommandTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/command/ReorderColumnCommandTest.java @@ -12,19 +12,19 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.reorder.command; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.command.ILayerCommand; import org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ReorderColumnCommandTest { private ColumnReorderLayer columnReorderLayer; - @Before + @BeforeEach public void setup() { this.columnReorderLayer = new ColumnReorderLayer(new DataLayerFixture()); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/command/ReorderRowCommandTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/command/ReorderRowCommandTest.java index d1f6a5d4..e834c7a7 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/command/ReorderRowCommandTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/command/ReorderRowCommandTest.java @@ -12,19 +12,19 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.reorder.command; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.command.ILayerCommand; import org.eclipse.nebula.widgets.nattable.reorder.RowReorderLayer; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ReorderRowCommandTest { private RowReorderLayer rowReorderLayer; - @Before + @BeforeEach public void setup() { this.rowReorderLayer = new RowReorderLayer(new DataLayerFixture()); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/event/MultiColumnReorderEventDiffTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/event/MultiColumnReorderEventDiffTest.java index 3e42fb0f..7b2d10fd 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/event/MultiColumnReorderEventDiffTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/event/MultiColumnReorderEventDiffTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,11 +12,11 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.reorder.event; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Collection; import java.util.Iterator; @@ -28,9 +28,9 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; import org.eclipse.swt.graphics.Rectangle; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class MultiColumnReorderEventDiffTest { @@ -38,7 +38,7 @@ public class MultiColumnReorderEventDiffTest { private DataLayerFixture dataLayer; private ViewportLayer viewportLayer; - @Before + @BeforeEach public void before() { this.dataLayer = new DataLayerFixture(20, 20, 100, 40); this.viewportLayer = new ViewportLayer(this.dataLayer); @@ -54,7 +54,7 @@ public class MultiColumnReorderEventDiffTest { this.viewportLayer.setOriginY(this.viewportLayer.getStartYOfRowPosition(2)); } - @After + @AfterEach public void after() { assertTrue(this.event.isHorizontalStructureChanged()); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/event/MultiRowReorderEventDiffTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/event/MultiRowReorderEventDiffTest.java index f46e9381..25e926c3 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/event/MultiRowReorderEventDiffTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/event/MultiRowReorderEventDiffTest.java @@ -12,11 +12,11 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.reorder.event; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Collection; import java.util.Iterator; @@ -28,9 +28,9 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; import org.eclipse.swt.graphics.Rectangle; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class MultiRowReorderEventDiffTest { @@ -38,7 +38,7 @@ public class MultiRowReorderEventDiffTest { private DataLayerFixture dataLayer; private ViewportLayer viewportLayer; - @Before + @BeforeEach public void before() { this.dataLayer = new DataLayerFixture(20, 20, 100, 40); this.viewportLayer = new ViewportLayer(this.dataLayer); @@ -54,7 +54,7 @@ public class MultiRowReorderEventDiffTest { this.viewportLayer.setOriginY(this.viewportLayer.getStartYOfRowPosition(2)); } - @After + @AfterEach public void after() { assertFalse(this.event.isHorizontalStructureChanged()); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/event/ReorderColumnEventTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/event/ReorderColumnEventTest.java index bbda1882..88e552ed 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/event/ReorderColumnEventTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/event/ReorderColumnEventTest.java @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.reorder.event; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; import java.util.Iterator; @@ -31,7 +31,7 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.BaseColumnReorderLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ReorderColumnEventTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/event/ReorderRowEventTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/event/ReorderRowEventTest.java index fe9f37f6..5cc7a532 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/event/ReorderRowEventTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/reorder/event/ReorderRowEventTest.java @@ -12,9 +12,9 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.reorder.event; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; import java.util.Iterator; @@ -37,7 +37,7 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ReorderRowEventTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/AutoResizeColumnsTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/AutoResizeColumnsTest.java index 5d19759e..d157900b 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/AutoResizeColumnsTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/AutoResizeColumnsTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.resize; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes; import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry; @@ -36,7 +36,6 @@ import org.eclipse.nebula.widgets.nattable.style.DisplayMode; import org.eclipse.nebula.widgets.nattable.style.Style; import org.eclipse.nebula.widgets.nattable.util.GCFactory; import org.eclipse.nebula.widgets.nattable.util.GUIHelper; -import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.FontData; @@ -44,9 +43,9 @@ import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class AutoResizeColumnsTest { @@ -54,7 +53,7 @@ public class AutoResizeColumnsTest { private Image img; private GCFactory gcFactory; - @Before + @BeforeEach public void setUp() { this.configRegistry = new ConfigRegistry(); new DefaultNatTableStyleConfiguration() @@ -73,18 +72,13 @@ public class AutoResizeColumnsTest { cellStyle, DisplayMode.NORMAL); } - @After + @AfterEach public void tearDown() { this.img.dispose(); } private void setClientAreaProvider(ILayer layer) { - layer.setClientAreaProvider(new IClientAreaProvider() { - @Override - public Rectangle getClientArea() { - return new Rectangle(0, 0, 1050, 250); - } - }); + layer.setClientAreaProvider(() -> new Rectangle(0, 0, 1050, 250)); layer.doCommand(new ClientAreaResizeCommand(new Shell(Display .getDefault(), SWT.V_SCROLL | SWT.H_SCROLL))); } @@ -93,7 +87,7 @@ public class AutoResizeColumnsTest { * These sequence of actions were causing a nasty bug in AutoResize */ @Test - public void autoResizeOneColumn() throws Exception { + public void autoResizeOneColumn() { GridLayer gridLayer = new DummyGridLayerStack(); setClientAreaProvider(gridLayer); @@ -125,10 +119,10 @@ public class AutoResizeColumnsTest { for (int columnPosition = 1; columnPosition <= 20; columnPosition++) { assertTrue( + gridLayer.getColumnWidthByPosition(columnPosition) != 100, "column " + columnPosition - + " should have been resized, but it is still its original width", - gridLayer.getColumnWidthByPosition(columnPosition) != 100); + + " should have been resized, but it is still its original width"); } } @@ -137,8 +131,7 @@ public class AutoResizeColumnsTest { * resized. */ @Test - public void shouldAutoResizeCorrectlyIfMultipleColumnsAreSelected() - throws Exception { + public void shouldAutoResizeCorrectlyIfMultipleColumnsAreSelected() { GridLayer gridLayer = new DefaultGridLayer( RowDataListFixture.getList(), RowDataListFixture.getPropertyNames(), diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/MaxCellBoundsHelperTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/MaxCellBoundsHelperTest.java index 574108b6..5ec16b1c 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/MaxCellBoundsHelperTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/MaxCellBoundsHelperTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.resize; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry; import org.eclipse.nebula.widgets.nattable.data.IDataProvider; @@ -24,7 +24,7 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.util.GCFactory; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class MaxCellBoundsHelperTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/ResizeColumnTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/ResizeColumnTest.java index 7c9ec923..64a8bb5a 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/ResizeColumnTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/ResizeColumnTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,14 +12,14 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.resize; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.layer.NoScalingDpiConverter; import org.eclipse.nebula.widgets.nattable.layer.command.ConfigureScalingCommand; import org.eclipse.nebula.widgets.nattable.layer.stack.DummyGridLayerStack; import org.eclipse.nebula.widgets.nattable.resize.command.ColumnResizeCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ResizeColumnTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/ColumnResizeCommandTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/ColumnResizeCommandTest.java index ab87b9d2..dfbe2be2 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/ColumnResizeCommandTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/ColumnResizeCommandTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.resize.command; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand; import org.eclipse.nebula.widgets.nattable.grid.data.DummyBodyDataProvider; @@ -20,14 +20,14 @@ import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.layer.FixedScalingDpiConverter; import org.eclipse.nebula.widgets.nattable.layer.command.ConfigureScalingCommand; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnResizeCommandTest { private DataLayer dataLayer; - @Before + @BeforeEach public void setup() { this.dataLayer = new DataLayer(new DummyBodyDataProvider(10, 10)); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/ColumnSizeConfigurationCommandTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/ColumnSizeConfigurationCommandTest.java index 92f44a0e..d4899ddb 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/ColumnSizeConfigurationCommandTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/ColumnSizeConfigurationCommandTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.resize.command; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.grid.GridRegion; import org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand; @@ -22,14 +22,14 @@ import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.layer.cell.ColumnLabelAccumulator; import org.eclipse.nebula.widgets.nattable.layer.stack.DummyGridLayerStack; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnSizeConfigurationCommandTest { private DataLayer dataLayer; - @Before + @BeforeEach public void setup() { this.dataLayer = new DataLayer(new DummyBodyDataProvider(4, 4)); this.dataLayer.setConfigLabelAccumulator(new ColumnLabelAccumulator()); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/ColumnSizeResetCommandTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/ColumnSizeResetCommandTest.java index 5d9bc9f1..67c7fa5e 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/ColumnSizeResetCommandTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/ColumnSizeResetCommandTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2020 Dirk Fauth. + * Copyright (c) 2017, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.resize.command; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.grid.GridRegion; @@ -26,15 +26,15 @@ import org.eclipse.nebula.widgets.nattable.layer.event.ColumnStructuralRefreshEv import org.eclipse.nebula.widgets.nattable.layer.stack.DummyGridLayerStack; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnSizeResetCommandTest { private DataLayer dataLayer; private LayerListenerFixture listener; - @Before + @BeforeEach public void setup() { this.dataLayer = new DataLayer(new DummyBodyDataProvider(10, 10)); this.listener = new LayerListenerFixture(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/MultiColumnResizeCommandTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/MultiColumnResizeCommandTest.java index 3c7d3575..d8a92954 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/MultiColumnResizeCommandTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/MultiColumnResizeCommandTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.resize.command; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand; import org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer; @@ -29,7 +29,7 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class MultiColumnResizeCommandTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/MultiRowResizeCommandTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/MultiRowResizeCommandTest.java index cccd681f..cb1576cf 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/MultiRowResizeCommandTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/MultiRowResizeCommandTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2020 Original authors and others. + * Copyright (c) 2017, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.resize.command; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand; import org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer; @@ -28,7 +28,7 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class MultiRowResizeCommandTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/RowResizeCommandTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/RowResizeCommandTest.java index c9c65088..b10c6d91 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/RowResizeCommandTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/RowResizeCommandTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.resize.command; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand; import org.eclipse.nebula.widgets.nattable.grid.data.DummyBodyDataProvider; @@ -20,14 +20,14 @@ import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.layer.FixedScalingDpiConverter; import org.eclipse.nebula.widgets.nattable.layer.command.ConfigureScalingCommand; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowResizeCommandTest { private DataLayer dataLayer; - @Before + @BeforeEach public void setup() { this.dataLayer = new DataLayer(new DummyBodyDataProvider(10, 10)); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/RowSizeConfigurationCommandTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/RowSizeConfigurationCommandTest.java index 8a46d5d6..54254218 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/RowSizeConfigurationCommandTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/RowSizeConfigurationCommandTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.resize.command; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.grid.GridRegion; import org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand; @@ -23,14 +23,14 @@ import org.eclipse.nebula.widgets.nattable.layer.LabelStack; import org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelAccumulator; import org.eclipse.nebula.widgets.nattable.layer.stack.DummyGridLayerStack; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowSizeConfigurationCommandTest { private DataLayer dataLayer; - @Before + @BeforeEach public void setup() { this.dataLayer = new DataLayer(new DummyBodyDataProvider(4, 4)); this.dataLayer.setConfigLabelAccumulator(new IConfigLabelAccumulator() { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/RowSizeResetCommandTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/RowSizeResetCommandTest.java index e98e56e6..4e62e934 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/RowSizeResetCommandTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/command/RowSizeResetCommandTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2020 Dirk Fauth. + * Copyright (c) 2017, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.resize.command; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.grid.GridRegion; @@ -26,15 +26,15 @@ import org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralRefreshEvent import org.eclipse.nebula.widgets.nattable.layer.stack.DummyGridLayerStack; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowSizeResetCommandTest { private DataLayer dataLayer; private LayerListenerFixture listener; - @Before + @BeforeEach public void setup() { this.dataLayer = new DataLayer(new DummyBodyDataProvider(10, 10)); this.listener = new LayerListenerFixture(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/event/ResizeEventDiffTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/event/ResizeEventDiffTest.java index 0d99e264..87844e5e 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/event/ResizeEventDiffTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/event/ResizeEventDiffTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,11 +12,11 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.resize.event; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Collection; @@ -27,16 +27,16 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; import org.eclipse.swt.graphics.Rectangle; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ResizeEventDiffTest { private ColumnResizeEvent event; private ViewportLayer viewportLayer; - @Before + @BeforeEach public void before() { DataLayerFixture dataLayer = new DataLayerFixture(20, 20, 100, 40); this.viewportLayer = new ViewportLayer(dataLayer); @@ -53,7 +53,7 @@ public class ResizeEventDiffTest { this.event = new ColumnResizeEvent(dataLayer, 2); } - @After + @AfterEach public void after() { assertTrue(this.event.isHorizontalStructureChanged()); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/event/ResizeEventPropagationTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/event/ResizeEventPropagationTest.java index 9c801783..cb96fd2a 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/event/ResizeEventPropagationTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/event/ResizeEventPropagationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,22 +12,22 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.resize.event; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.Collection; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ResizeEventPropagationTest { private LayerListenerFixture layerListener; private DataLayerFixture dataLayer; - @Before + @BeforeEach public void setUp() { // Total width should be 500 and total height should be 280 this.dataLayer = new DataLayerFixture(100, 40); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/event/ResizingVisibleReorderedColumnsTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/event/ResizingVisibleReorderedColumnsTest.java index 00a2b9b2..33756573 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/event/ResizingVisibleReorderedColumnsTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/event/ResizingVisibleReorderedColumnsTest.java @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.resize.event; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.Collection; @@ -20,9 +20,9 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.layer.BaseColumnReorderL import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; /* * This test was for selective repainting during resize i.e paint the bare minimum needed. @@ -30,7 +30,7 @@ import org.junit.Test; * This would be a useful thing to do but is on low priority now. Hence these tests will * be ignored till we pick this up again. */ -@Ignore +@Disabled public class ResizingVisibleReorderedColumnsTest { private LayerListenerFixture layerListener; @@ -39,7 +39,7 @@ public class ResizingVisibleReorderedColumnsTest { private BaseColumnReorderLayerFixture reorderLayer; - @Before + @BeforeEach public void setUp() { this.dataLayer = new DataLayerFixture(100, 40); this.reorderLayer = new BaseColumnReorderLayerFixture(this.dataLayer); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/search/command/SearchGridCommandHandlerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/search/command/SearchGridCommandHandlerTest.java index 37206f63..f3753158 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/search/command/SearchGridCommandHandlerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/search/command/SearchGridCommandHandlerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,8 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.search.command; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.fail; import java.util.regex.PatternSyntaxException; @@ -32,14 +33,12 @@ import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; import org.eclipse.nebula.widgets.nattable.selection.command.SelectAllCommand; import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture; -import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class SearchGridCommandHandlerTest { @@ -59,17 +58,10 @@ public class SearchGridCommandHandlerTest { boolean isColumnFirst; PositionCoordinate expected; - @Before + @BeforeEach public void setUp() { this.gridLayer = new GridLayerFixture(); - this.gridLayer.setClientAreaProvider(new IClientAreaProvider() { - - @Override - public Rectangle getClientArea() { - return new Rectangle(0, 0, 1050, 250); - } - - }); + this.gridLayer.setClientAreaProvider(() -> new Rectangle(0, 0, 1050, 250)); this.gridLayer.doCommand( new ClientAreaResizeCommand( new Shell(Display.getDefault(), SWT.V_SCROLL | SWT.H_SCROLL))); @@ -143,23 +135,20 @@ public class SearchGridCommandHandlerTest { private void doTestOnSelection() throws PatternSyntaxException { // Register call back - final ILayerListener listener = new ILayerListener() { - @Override - public void handleLayerEvent(ILayerEvent event) { - if (event instanceof SearchEvent) { - // Check event, coordinate should be in composite layer - // coordinates - SearchEvent searchEvent = (SearchEvent) event; - if (SearchGridCommandHandlerTest.this.expected != null) { - assertEquals( - SearchGridCommandHandlerTest.this.expected.columnPosition, - searchEvent.getCellCoordinate().getColumnPosition()); - assertEquals( - SearchGridCommandHandlerTest.this.expected.rowPosition, - searchEvent.getCellCoordinate().getRowPosition()); - } else { - assertNull(searchEvent.getCellCoordinate()); - } + final ILayerListener listener = event -> { + if (event instanceof SearchEvent) { + // Check event, coordinate should be in composite layer + // coordinates + SearchEvent searchEvent = (SearchEvent) event; + if (SearchGridCommandHandlerTest.this.expected != null) { + assertEquals( + SearchGridCommandHandlerTest.this.expected.columnPosition, + searchEvent.getCellCoordinate().getColumnPosition()); + assertEquals( + SearchGridCommandHandlerTest.this.expected.rowPosition, + searchEvent.getCellCoordinate().getRowPosition()); + } else { + assertNull(searchEvent.getCellCoordinate()); } } }; @@ -422,7 +411,7 @@ public class SearchGridCommandHandlerTest { this.searchText = "[2"; this.expected = null; doTest(); - Assert.fail("Invalid regex didn't throw as expected"); + fail("Invalid regex didn't throw as expected"); } catch (PatternSyntaxException e) { } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/search/strategy/ColumnSearchStrategyTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/search/strategy/ColumnSearchStrategyTest.java index 04f1d492..e994cb82 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/search/strategy/ColumnSearchStrategyTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/search/strategy/ColumnSearchStrategyTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.search.strategy; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes; import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry; @@ -22,8 +22,8 @@ import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer; import org.eclipse.nebula.widgets.nattable.layer.ILayer; import org.eclipse.nebula.widgets.nattable.search.CellValueAsStringComparator; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnSearchStrategyTest { @@ -31,7 +31,7 @@ public class ColumnSearchStrategyTest { private ILayer layer; private ConfigRegistry configRegistry; - @Before + @BeforeEach public void setUp() { this.gridLayer = new GridLayerFixture(); this.layer = this.gridLayer.getBodyLayer().getSelectionLayer(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/search/strategy/GridSearchStrategyTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/search/strategy/GridSearchStrategyTest.java index 48f84c9b..ec0c8818 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/search/strategy/GridSearchStrategyTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/search/strategy/GridSearchStrategyTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.search.strategy; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry; import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration; @@ -41,8 +41,8 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class GridSearchStrategyTest { @@ -55,7 +55,7 @@ public class GridSearchStrategyTest { private SelectionLayer spanningSelectionLayer; private ConfigRegistry spanningConfigRegistry; - @Before + @BeforeEach public void setUp() { this.gridLayer = new DefaultGridLayer(getBodyDataProvider(), GridLayerFixture.colHeaderDataProvider); this.selectionLayer = this.gridLayer.getBodyLayer().getSelectionLayer(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/search/strategy/RowSearchStrategyTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/search/strategy/RowSearchStrategyTest.java index ffb649e6..98e91fe5 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/search/strategy/RowSearchStrategyTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/search/strategy/RowSearchStrategyTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.search.strategy; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry; import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration; @@ -21,8 +21,8 @@ import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer; import org.eclipse.nebula.widgets.nattable.layer.ILayer; import org.eclipse.nebula.widgets.nattable.search.CellValueAsStringComparator; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowSearchStrategyTest { @@ -30,7 +30,7 @@ public class RowSearchStrategyTest { private ILayer layer; private ConfigRegistry configRegistry; - @Before + @BeforeEach public void setUp() { this.gridLayer = new GridLayerFixture(); this.layer = this.gridLayer.getBodyLayer().getSelectionLayer(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/search/strategy/SelectionSearchStrategyTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/search/strategy/SelectionSearchStrategyTest.java index 67643f59..1e09b4df 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/search/strategy/SelectionSearchStrategyTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/search/strategy/SelectionSearchStrategyTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.search.strategy; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry; import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration; @@ -33,8 +33,8 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class SelectionSearchStrategyTest { @@ -45,7 +45,7 @@ public class SelectionSearchStrategyTest { private ConfigRegistry configRegistry; private IDataProvider bodyDataProvider; - @Before + @BeforeEach public void setUp() { this.bodyDataProvider = new IDataProvider() { @Override diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/CellSelectionTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/CellSelectionTest.java index 0e50c509..50ae445f 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/CellSelectionTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/CellSelectionTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -13,7 +13,9 @@ package org.eclipse.nebula.widgets.nattable.selection; import static org.eclipse.nebula.widgets.nattable.selection.SelectionLayer.MoveDirectionEnum.RIGHT; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Collection; @@ -23,10 +25,9 @@ import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer.MoveDirectio import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.util.ArrayUtil; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class CellSelectionTest { @@ -57,7 +58,7 @@ public class CellSelectionTest { }; - @Before + @BeforeEach public void setUp() { this.selectionLayer = new SelectionLayer(new DataLayerFixture(10, 10, 100, 40)); // Selection grid origin as starting point @@ -65,14 +66,14 @@ public class CellSelectionTest { this.moveCommandHandler = new MoveCellSelectionCommandHandler(this.selectionLayer); } - @After + @AfterEach public void cleanUp() { this.selectionLayer.clear(); } @Test public void shouldHaveOriginSelected() { - Assert.assertTrue(isLastCellInOrigin()); + assertTrue(isLastCellInOrigin()); } private boolean isLastCellInOrigin() { @@ -108,17 +109,17 @@ public class CellSelectionTest { this.moveCommandHandler.moveSelection( MoveDirectionEnum.LEFT, ITraversalStrategy.AXIS_TRAVERSAL_STRATEGY, false, false); // Should not have moved - Assert.assertTrue(isLastCellInOrigin()); + assertTrue(isLastCellInOrigin()); this.selectionLayer.setSelectedCell(1, 0); // Should move back to origin this.moveCommandHandler.moveSelection( MoveDirectionEnum.LEFT, ITraversalStrategy.AXIS_TRAVERSAL_STRATEGY, false, false); - Assert.assertTrue(isLastCellInOrigin()); + assertTrue(isLastCellInOrigin()); // Previous selection was cleared - Assert.assertTrue(wasPreviousSelectionCleared()); + assertTrue(wasPreviousSelectionCleared()); } @Test @@ -126,7 +127,7 @@ public class CellSelectionTest { this.moveCommandHandler.moveSelection( MoveDirectionEnum.LEFT, ITraversalStrategy.AXIS_TRAVERSAL_STRATEGY, true, false); // Should not have moved - Assert.assertTrue(isLastCellInOrigin()); + assertTrue(isLastCellInOrigin()); this.selectionLayer.setSelectedCell(2, 0); @@ -137,16 +138,16 @@ public class CellSelectionTest { // Last selected cell should now be the origin this.moveCommandHandler.moveSelection( MoveDirectionEnum.LEFT, ITraversalStrategy.AXIS_TRAVERSAL_STRATEGY, true, false); - Assert.assertTrue(isLastCellInOrigin()); + assertTrue(isLastCellInOrigin()); // Selection anchor should not have changed - Assert.assertEquals(2, this.selectionLayer.getSelectionAnchor() + assertEquals(2, this.selectionLayer.getSelectionAnchor() .getColumnPosition()); - Assert.assertEquals(0, this.selectionLayer.getSelectionAnchor() + assertEquals(0, this.selectionLayer.getSelectionAnchor() .getRowPosition()); // Cells in between should have been appended - Assert.assertTrue(wasPreviousColumnSelectionAppended()); + assertTrue(wasPreviousColumnSelectionAppended()); } @Test @@ -156,16 +157,16 @@ public class CellSelectionTest { // Previous selection was cleared and origin should no longer be // selected - Assert.assertFalse(isLastCellInOrigin()); + assertFalse(isLastCellInOrigin()); // The selection anchor moved right - Assert.assertEquals(1, this.selectionLayer.getSelectionAnchor() + assertEquals(1, this.selectionLayer.getSelectionAnchor() .getColumnPosition()); - Assert.assertEquals(0, this.selectionLayer.getSelectionAnchor() + assertEquals(0, this.selectionLayer.getSelectionAnchor() .getRowPosition()); // Previous selection was cleared - Assert.assertTrue(wasPreviousSelectionCleared()); + assertTrue(wasPreviousSelectionCleared()); } @Test @@ -177,17 +178,17 @@ public class CellSelectionTest { // Since selection started at origin, then origin should be part of the // selected range - Assert.assertTrue(isSelectonAnchorInOrigin()); + assertTrue(isSelectonAnchorInOrigin()); // Selection should now end on the cell to the right of the selection // anchor - Assert.assertEquals(2, this.selectionLayer.getLastSelectedCellPosition() + assertEquals(2, this.selectionLayer.getLastSelectedCellPosition() .getColumnPosition()); - Assert.assertEquals(0, this.selectionLayer.getSelectionAnchor() + assertEquals(0, this.selectionLayer.getSelectionAnchor() .getColumnPosition()); // Cells in between should have been appended - Assert.assertTrue(wasPreviousColumnSelectionAppended()); + assertTrue(wasPreviousColumnSelectionAppended()); } @Test @@ -196,7 +197,7 @@ public class CellSelectionTest { MoveDirectionEnum.UP, ITraversalStrategy.AXIS_TRAVERSAL_STRATEGY, false, false); // Should not have moved - Assert.assertTrue(isLastCellInOrigin()); + assertTrue(isLastCellInOrigin()); this.selectionLayer.setSelectedCell(0, 2); @@ -205,10 +206,10 @@ public class CellSelectionTest { MoveDirectionEnum.UP, ITraversalStrategy.AXIS_TRAVERSAL_STRATEGY, false, false); this.moveCommandHandler.moveSelection( MoveDirectionEnum.UP, ITraversalStrategy.AXIS_TRAVERSAL_STRATEGY, false, false); - Assert.assertTrue(isLastCellInOrigin()); + assertTrue(isLastCellInOrigin()); // Previous selection was cleared - Assert.assertTrue(wasPreviousSelectionCleared()); + assertTrue(wasPreviousSelectionCleared()); } @Test @@ -218,16 +219,16 @@ public class CellSelectionTest { MoveDirectionEnum.UP, ITraversalStrategy.AXIS_TRAVERSAL_STRATEGY, true, false); // Anchor should not have changed - Assert.assertEquals(1, this.selectionLayer.getSelectionAnchor() + assertEquals(1, this.selectionLayer.getSelectionAnchor() .getRowPosition()); - Assert.assertEquals(0, this.selectionLayer.getSelectionAnchor() + assertEquals(0, this.selectionLayer.getSelectionAnchor() .getColumnPosition()); // Last selected cell should be the origin - Assert.assertTrue(isLastCellInOrigin()); + assertTrue(isLastCellInOrigin()); // Cells in between should have been appended - Assert.assertTrue(wasPreviousRowSelectionAppended()); + assertTrue(wasPreviousRowSelectionAppended()); } @Test @@ -237,16 +238,16 @@ public class CellSelectionTest { // Previous selection was cleared and origin should no longer be // selected - Assert.assertFalse(isLastCellInOrigin()); + assertFalse(isLastCellInOrigin()); // Las selected cell is one step below origin - Assert.assertEquals(0, this.selectionLayer.getLastSelectedCellPosition() + assertEquals(0, this.selectionLayer.getLastSelectedCellPosition() .getColumnPosition()); - Assert.assertEquals(1, this.selectionLayer.getLastSelectedCellPosition() + assertEquals(1, this.selectionLayer.getLastSelectedCellPosition() .getRowPosition()); // Previous selection was cleared - Assert.assertTrue(wasPreviousSelectionCleared()); + assertTrue(wasPreviousSelectionCleared()); } @Test @@ -255,16 +256,16 @@ public class CellSelectionTest { MoveDirectionEnum.DOWN, ITraversalStrategy.AXIS_TRAVERSAL_STRATEGY, true, false); // Selection anchor remains at origing - Assert.assertTrue(isSelectonAnchorInOrigin()); + assertTrue(isSelectonAnchorInOrigin()); // Las selected cell is one step below origin - Assert.assertEquals(0, this.selectionLayer.getLastSelectedCellPosition() + assertEquals(0, this.selectionLayer.getLastSelectedCellPosition() .getColumnPosition()); - Assert.assertEquals(1, this.selectionLayer.getLastSelectedCellPosition() + assertEquals(1, this.selectionLayer.getLastSelectedCellPosition() .getRowPosition()); // Cells in between should have been appended - Assert.assertTrue(wasPreviousRowSelectionAppended()); + assertTrue(wasPreviousRowSelectionAppended()); } @Test @@ -273,7 +274,7 @@ public class CellSelectionTest { MoveDirectionEnum.LEFT, this.AXIS_TRAVERSAL_ALL, false, false); // Should not have moved - Assert.assertTrue(isLastCellInOrigin()); + assertTrue(isLastCellInOrigin()); // Move to middle of grid this.selectionLayer.setSelectedCell(2, 0); @@ -281,10 +282,10 @@ public class CellSelectionTest { // Should move back to origin this.moveCommandHandler.moveSelection( MoveDirectionEnum.LEFT, this.AXIS_TRAVERSAL_ALL, false, false); - Assert.assertTrue(isLastCellInOrigin()); + assertTrue(isLastCellInOrigin()); // Previous selection was cleared - Assert.assertTrue(wasPreviousSelectionCleared()); + assertTrue(wasPreviousSelectionCleared()); } @Test @@ -293,7 +294,7 @@ public class CellSelectionTest { MoveDirectionEnum.LEFT, this.AXIS_TRAVERSAL_ALL, true, false); // Should not have moved - Assert.assertTrue(isLastCellInOrigin()); + assertTrue(isLastCellInOrigin()); // Move to middle of grid this.selectionLayer.setSelectedCell(2, 0); @@ -301,16 +302,16 @@ public class CellSelectionTest { // Should move back to origin this.moveCommandHandler.moveSelection( MoveDirectionEnum.LEFT, this.AXIS_TRAVERSAL_ALL, true, false); - Assert.assertTrue(isLastCellInOrigin()); + assertTrue(isLastCellInOrigin()); // Selection anchor should not have changed - Assert.assertEquals(2, this.selectionLayer.getSelectionAnchor() + assertEquals(2, this.selectionLayer.getSelectionAnchor() .getColumnPosition()); - Assert.assertEquals(0, this.selectionLayer.getSelectionAnchor() + assertEquals(0, this.selectionLayer.getSelectionAnchor() .getRowPosition()); // Cells in between should have been appended - Assert.assertTrue(wasPreviousColumnSelectionAppended()); + assertTrue(wasPreviousColumnSelectionAppended()); } @Test @@ -319,17 +320,17 @@ public class CellSelectionTest { MoveDirectionEnum.RIGHT, this.AXIS_TRAVERSAL_ALL, false, false); // Selection anchor moved to end of grid - Assert.assertEquals(9, this.selectionLayer.getSelectionAnchor() + assertEquals(9, this.selectionLayer.getSelectionAnchor() .getColumnPosition()); - Assert.assertEquals(0, this.selectionLayer.getSelectionAnchor() + assertEquals(0, this.selectionLayer.getSelectionAnchor() .getRowPosition()); // Previous selection was cleared and origin should no longer be // selected - Assert.assertFalse(isLastCellInOrigin()); + assertFalse(isLastCellInOrigin()); // Previous selection was cleared - Assert.assertTrue(wasPreviousSelectionCleared()); + assertTrue(wasPreviousSelectionCleared()); } @Test @@ -338,16 +339,16 @@ public class CellSelectionTest { MoveDirectionEnum.RIGHT, this.AXIS_TRAVERSAL_ALL, true, false); // Selection anchor should stay at the origin - Assert.assertTrue(isSelectonAnchorInOrigin()); + assertTrue(isSelectonAnchorInOrigin()); // Last selected cell is at end of grid - Assert.assertEquals(9, this.selectionLayer.getLastSelectedCellPosition() + assertEquals(9, this.selectionLayer.getLastSelectedCellPosition() .getColumnPosition()); - Assert.assertEquals(0, this.selectionLayer.getLastSelectedCellPosition() + assertEquals(0, this.selectionLayer.getLastSelectedCellPosition() .getRowPosition()); // Cells in between should have been appended - Assert.assertTrue(wasPreviousColumnSelectionAppended()); + assertTrue(wasPreviousColumnSelectionAppended()); } @Test @@ -380,7 +381,7 @@ public class CellSelectionTest { MoveDirectionEnum.UP, customTraversal, false, false); // Should not have moved - Assert.assertTrue(isLastCellInOrigin()); + assertTrue(isLastCellInOrigin()); // Move to middle of grid final int columnPosition = 2; @@ -417,7 +418,7 @@ public class CellSelectionTest { // Previous selection was cleared and origin should no longer be // selected - Assert.assertFalse(isLastCellInOrigin()); + assertFalse(isLastCellInOrigin()); customTraversal = new ITraversalStrategy() { @@ -447,13 +448,13 @@ public class CellSelectionTest { // available number of rows this.moveCommandHandler.moveSelection( MoveDirectionEnum.UP, customTraversal, false, false); - Assert.assertEquals(2, this.selectionLayer.getLastSelectedCellPosition() + assertEquals(2, this.selectionLayer.getLastSelectedCellPosition() .getColumnPosition()); - Assert.assertEquals(0, this.selectionLayer.getLastSelectedCellPosition() + assertEquals(0, this.selectionLayer.getLastSelectedCellPosition() .getRowPosition()); // Previous selection was cleared - Assert.assertTrue(wasPreviousSelectionCleared()); + assertTrue(wasPreviousSelectionCleared()); } @Test @@ -491,19 +492,19 @@ public class CellSelectionTest { // available number of rows this.moveCommandHandler.moveSelection( MoveDirectionEnum.UP, customTraversal, true, false); - Assert.assertEquals(2, this.selectionLayer.getLastSelectedCellPosition() + assertEquals(2, this.selectionLayer.getLastSelectedCellPosition() .getColumnPosition()); - Assert.assertEquals(0, this.selectionLayer.getLastSelectedCellPosition() + assertEquals(0, this.selectionLayer.getLastSelectedCellPosition() .getRowPosition()); // Selection anchor should not have changed - Assert.assertEquals(2, this.selectionLayer.getSelectionAnchor() + assertEquals(2, this.selectionLayer.getSelectionAnchor() .getColumnPosition()); - Assert.assertEquals(4, this.selectionLayer.getSelectionAnchor() + assertEquals(4, this.selectionLayer.getSelectionAnchor() .getRowPosition()); // Cells in between should have been appended - Assert.assertTrue(wasPreviousRowSelectionAppended()); + assertTrue(wasPreviousRowSelectionAppended()); } @Test @@ -563,13 +564,13 @@ public class CellSelectionTest { // number of rows this.moveCommandHandler.moveSelection( MoveDirectionEnum.DOWN, customTraversal, false, false); - Assert.assertEquals(0, this.selectionLayer.getLastSelectedCellPosition() + assertEquals(0, this.selectionLayer.getLastSelectedCellPosition() .getColumnPosition()); - Assert.assertEquals(9, this.selectionLayer.getLastSelectedCellPosition() + assertEquals(9, this.selectionLayer.getLastSelectedCellPosition() .getRowPosition()); // Previous selection was cleared - Assert.assertTrue(wasPreviousSelectionCleared()); + assertTrue(wasPreviousSelectionCleared()); } @Test @@ -602,16 +603,16 @@ public class CellSelectionTest { MoveDirectionEnum.DOWN, customTraversal, true, false); // Selection anchor should not have changed - Assert.assertTrue(isSelectonAnchorInOrigin()); + assertTrue(isSelectonAnchorInOrigin()); // Last selected cell should be in the last row - Assert.assertEquals(0, this.selectionLayer.getLastSelectedCellPosition() + assertEquals(0, this.selectionLayer.getLastSelectedCellPosition() .getColumnPosition()); - Assert.assertEquals(6, this.selectionLayer.getLastSelectedCellPosition() + assertEquals(6, this.selectionLayer.getLastSelectedCellPosition() .getRowPosition()); // Previous selection was cleared - Assert.assertTrue(wasPreviousRowSelectionAppended()); + assertTrue(wasPreviousRowSelectionAppended()); } /** @@ -646,19 +647,19 @@ public class CellSelectionTest { false, true)); PositionCoordinate[] cells = this.selectionLayer.getSelectedCellPositions(); - Assert.assertEquals(4, cells.length); + assertEquals(4, cells.length); // (1, 0) - Assert.assertEquals(1, cells[0].columnPosition); - Assert.assertEquals(0, cells[0].rowPosition); + assertEquals(1, cells[0].columnPosition); + assertEquals(0, cells[0].rowPosition); // (2, 3) - Assert.assertEquals(2, cells[1].columnPosition); - Assert.assertEquals(3, cells[1].rowPosition); + assertEquals(2, cells[1].columnPosition); + assertEquals(3, cells[1].rowPosition); // (4, 1) - Assert.assertEquals(4, cells[2].columnPosition); - Assert.assertEquals(1, cells[2].rowPosition); + assertEquals(4, cells[2].columnPosition); + assertEquals(1, cells[2].rowPosition); // (9, 9) - Assert.assertEquals(9, cells[3].columnPosition); - Assert.assertEquals(9, cells[3].rowPosition); + assertEquals(9, cells[3].columnPosition); + assertEquals(9, cells[3].rowPosition); } @Test @@ -680,24 +681,24 @@ public class CellSelectionTest { Collection<PositionCoordinate> cells = ArrayUtil .asCollection(this.selectionLayer.getSelectedCellPositions()); - Assert.assertEquals(6, cells.size()); + assertEquals(6, cells.size()); // (1, 0) - Assert.assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer, + assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer, 1, 0))); // (1, 1) - Assert.assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer, + assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer, 1, 1))); // (1, 2) - Assert.assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer, + assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer, 1, 2))); // (2, 0) - Assert.assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer, + assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer, 2, 0))); // (2, 1) - Assert.assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer, + assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer, 2, 1))); // (2, 2) - Assert.assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer, + assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer, 2, 2))); } @@ -711,8 +712,8 @@ public class CellSelectionTest { Collection<PositionCoordinate> cells = ArrayUtil .asCollection(this.selectionLayer.getSelectedCellPositions()); - Assert.assertEquals(1, cells.size()); - Assert.assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer, + assertEquals(1, cells.size()); + assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer, 1, 0))); // select another cell with control mask @@ -721,8 +722,8 @@ public class CellSelectionTest { cells = ArrayUtil.asCollection(this.selectionLayer .getSelectedCellPositions()); - Assert.assertEquals(1, cells.size()); - Assert.assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer, + assertEquals(1, cells.size()); + assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer, 2, 0))); // select additional cells with shift mask @@ -732,8 +733,8 @@ public class CellSelectionTest { cells = ArrayUtil.asCollection(this.selectionLayer .getSelectedCellPositions()); - Assert.assertEquals(1, cells.size()); - Assert.assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer, + assertEquals(1, cells.size()); + assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer, 2, 0))); // select additional cells with shift mask @@ -743,8 +744,8 @@ public class CellSelectionTest { cells = ArrayUtil.asCollection(this.selectionLayer .getSelectedCellPositions()); - Assert.assertEquals(1, cells.size()); - Assert.assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer, + assertEquals(1, cells.size()); + assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer, 2, 0))); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/CellSelectionTraversalTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/CellSelectionTraversalTest.java index 5283df02..3350e44d 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/CellSelectionTraversalTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/CellSelectionTraversalTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2020 Dirk Fauth. + * Copyright (c) 2014, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,29 +12,29 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell; import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer.MoveDirectionEnum; import org.eclipse.nebula.widgets.nattable.selection.command.MoveSelectionCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class CellSelectionTraversalTest { private SelectionLayer selectionLayer; private ViewportLayer viewportLayer; - @Before + @BeforeEach public void setUp() { this.selectionLayer = new SelectionLayer(new DataLayerFixture(10, 10, 100, 20)); this.viewportLayer = new ViewportLayer(this.selectionLayer); } - @After + @AfterEach public void cleanUp() { this.selectionLayer.clear(); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/ColumnSelectionTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/ColumnSelectionTest.java index 1069714c..b0300ece 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/ColumnSelectionTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/ColumnSelectionTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Collection; @@ -23,9 +23,9 @@ import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand; import org.eclipse.nebula.widgets.nattable.selection.command.SelectColumnCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.util.ArrayUtil; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnSelectionTest { // Tests for column selection NTBL-225 @@ -33,7 +33,7 @@ public class ColumnSelectionTest { private SelectionLayer selectionLayer; private SelectColumnCommandHandler commandHandler; - @Before + @BeforeEach public void setUp() { this.selectionLayer = new SelectionLayer(new DataLayerFixture(10, 50, 100, 40)); // Selection grid origin as starting point @@ -41,7 +41,7 @@ public class ColumnSelectionTest { this.commandHandler = new SelectColumnCommandHandler(this.selectionLayer); } - @After + @AfterEach public void cleanUp() { this.selectionLayer.clear(); } @@ -113,9 +113,9 @@ public class ColumnSelectionTest { assertEquals(4, this.selectionLayer.getSelectionAnchor().getColumnPosition()); assertEquals(0, this.selectionLayer.getSelectionAnchor().getRowPosition()); - assertFalse("column 3 fully selected", this.selectionLayer.isColumnPositionFullySelected(3)); - assertTrue("column 4 not fully selected", this.selectionLayer.isColumnPositionFullySelected(4)); - assertFalse("column 5 fully selected", this.selectionLayer.isColumnPositionFullySelected(5)); + assertFalse(this.selectionLayer.isColumnPositionFullySelected(3), "column 3 fully selected"); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(4), "column 4 not fully selected"); + assertFalse(this.selectionLayer.isColumnPositionFullySelected(5), "column 5 fully selected"); } @Test @@ -127,25 +127,24 @@ public class ColumnSelectionTest { this.selectionLayer.doCommand(new SelectColumnCommand(this.selectionLayer, 2, 0, true, false)); for (int col = 2; col <= 4; col++) { - assertTrue("column " + col + " not fully selected", this.selectionLayer.isColumnPositionFullySelected(col)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(col), "column " + col + " not fully selected"); } - assertFalse("column 5 fully selected", this.selectionLayer.isColumnPositionFullySelected(5)); + assertFalse(this.selectionLayer.isColumnPositionFullySelected(5), "column 5 fully selected"); // select columns to the right this.selectionLayer.doCommand(new SelectColumnCommand(this.selectionLayer, 6, 0, true, false)); - assertFalse("column 2 fully selected", this.selectionLayer.isColumnPositionFullySelected(2)); - assertFalse("column 3 fully selected", this.selectionLayer.isColumnPositionFullySelected(3)); + assertFalse(this.selectionLayer.isColumnPositionFullySelected(2), "column 2 fully selected"); + assertFalse(this.selectionLayer.isColumnPositionFullySelected(3), "column 3 fully selected"); for (int col = 4; col <= 6; col++) { - assertTrue("column " + col + " not fully selected", this.selectionLayer.isColumnPositionFullySelected(col)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(col), "column " + col + " not fully selected"); } } private void assertCellsSelectedBetween(int startColPosition, int endColPosition) { for (int col = startColPosition; col <= endColPosition; col++) { for (int row = 0; row <= 6; row++) { - assertTrue("[" + col + ", " + row + "] not selected", - this.selectionLayer.isCellPositionSelected(col, row)); + assertTrue(this.selectionLayer.isCellPositionSelected(col, row), "[" + col + ", " + row + "] not selected"); } } } @@ -233,7 +232,7 @@ public class ColumnSelectionTest { assertEquals(0, this.selectionLayer.getSelectionAnchor().getRowPosition()); for (int col = 2; col <= 4; col++) { - assertTrue("column " + col + " not fully selected", this.selectionLayer.isColumnPositionFullySelected(col)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(col), "column " + col + " not fully selected"); } // deselect column 2 @@ -242,9 +241,9 @@ public class ColumnSelectionTest { assertEquals(3, this.selectionLayer.getSelectionAnchor().getColumnPosition()); assertEquals(0, this.selectionLayer.getSelectionAnchor().getRowPosition()); - assertFalse("column 2 fully selected", this.selectionLayer.isColumnPositionFullySelected(2)); + assertFalse(this.selectionLayer.isColumnPositionFullySelected(2), "column 2 fully selected"); for (int col = 3; col <= 4; col++) { - assertTrue("column " + col + " not fully selected", this.selectionLayer.isColumnPositionFullySelected(col)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(col), "column " + col + " not fully selected"); } } @@ -266,8 +265,8 @@ public class ColumnSelectionTest { assertEquals(4, this.selectionLayer.getSelectionAnchor().getColumnPosition()); assertEquals(0, this.selectionLayer.getSelectionAnchor().getRowPosition()); - assertFalse("[2, 0] is selected", this.selectionLayer.isCellPositionSelected(2, 0)); - assertTrue("column 4 not fully selected", this.selectionLayer.isColumnPositionFullySelected(4)); + assertFalse(this.selectionLayer.isCellPositionSelected(2, 0), "[2, 0] is selected"); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(4), "column 4 not fully selected"); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/EditTraversalStrategyLeftRightTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/EditTraversalStrategyLeftRightTest.java index 3aeff451..78356fbc 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/EditTraversalStrategyLeftRightTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/EditTraversalStrategyLeftRightTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2020 Dirk Fauth. + * Copyright (c) 2014, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import org.eclipse.nebula.widgets.nattable.config.IEditableRule; import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; @@ -29,9 +29,9 @@ import org.eclipse.nebula.widgets.nattable.test.integration.SWTUtils; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Text; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class EditTraversalStrategyLeftRightTest { @@ -42,7 +42,7 @@ public class EditTraversalStrategyLeftRightTest { private ViewportLayer viewportLayer; private NatTableFixture natTable; - @Before + @BeforeEach public void setUp() { this.dataLayer = new DataLayerFixture(10, 10, 100, 20); this.selectionLayer = new SelectionLayer(this.dataLayer); @@ -70,7 +70,7 @@ public class EditTraversalStrategyLeftRightTest { this.natTable.registerLabelOnColumn(this.dataLayer, 9, NOT_EDITABLE); } - @After + @AfterEach public void cleanUp() { this.selectionLayer.clear(); // since we are not interested in commit operations it is sufficient to diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/EditTraversalStrategyUpDownTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/EditTraversalStrategyUpDownTest.java index 88982aa0..d2751d56 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/EditTraversalStrategyUpDownTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/EditTraversalStrategyUpDownTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2020 Dirk Fauth. + * Copyright (c) 2014, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.io.Serializable; import java.util.Arrays; @@ -45,9 +45,9 @@ import org.eclipse.nebula.widgets.nattable.test.integration.SWTUtils; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Text; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class EditTraversalStrategyUpDownTest { @@ -60,7 +60,7 @@ public class EditTraversalStrategyUpDownTest { private RowOverrideLabelAccumulator<RowDataFixture> overrider; - @Before + @BeforeEach public void setUp() { // only use 10 columns to make the test cases easier String[] propertyNames = Arrays.copyOfRange(RowDataListFixture.getPropertyNames(), 0, 10); @@ -127,7 +127,7 @@ public class EditTraversalStrategyUpDownTest { this.dataLayer.setConfigLabelAccumulator(accumulator); } - @After + @AfterEach public void cleanUp() { this.selectionLayer.clear(); // since we are not interested in commit operations it is sufficient to diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/HideSelectedColumnsTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/HideSelectedColumnsTest.java index d1b9fd23..6c869d8e 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/HideSelectedColumnsTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/HideSelectedColumnsTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.nebula.widgets.nattable.data.IDataProvider; import org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider; @@ -37,14 +37,14 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class HideSelectedColumnsTest { private SelectionLayer selectionLayer; private ColumnHideShowLayer columnHideShowLayer; - @Before + @BeforeEach public void setUp() { this.columnHideShowLayer = new ColumnHideShowLayer(new DataLayerFixture()); this.selectionLayer = new SelectionLayer(this.columnHideShowLayer); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/HideSelectedRowsTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/HideSelectedRowsTest.java index faad18af..b138ac01 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/HideSelectedRowsTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/HideSelectedRowsTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; @@ -21,15 +21,15 @@ import org.eclipse.nebula.widgets.nattable.hideshow.RowHideShowLayer; import org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowHideCommand; import org.eclipse.nebula.widgets.nattable.hideshow.command.RowHideCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class HideSelectedRowsTest { private SelectionLayer selectionLayer; private RowHideShowLayer rowHideShowLayer; - @Before + @BeforeEach public void setUp() { this.rowHideShowLayer = new RowHideShowLayer(new DataLayerFixture()); this.selectionLayer = new SelectionLayer(this.rowHideShowLayer); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/MarkerSelectionModelTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/MarkerSelectionModelTest.java index 64a5e51c..5ad65d1a 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/MarkerSelectionModelTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/MarkerSelectionModelTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2020 Original authors and others. + * Copyright (c) 2014, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -16,10 +16,10 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; import java.util.List; import java.util.Set; @@ -29,8 +29,8 @@ import org.eclipse.nebula.widgets.nattable.layer.event.IStructuralChangeEvent; import org.eclipse.nebula.widgets.nattable.test.fixture.TestLayer; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class MarkerSelectionModelTest { @@ -39,7 +39,7 @@ public class MarkerSelectionModelTest { private StubbedMarkerSelectionModel markerSelectionModel = new StubbedMarkerSelectionModel(); - @Before + @BeforeEach public void setup() { String columnInfo = "0:0;100 | 1:1;100 | 2:2;100 | 3:3;100"; String rowInfo = "0:0;40 | 1:1;40 | 2:2;40 | 3:3;40"; diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/MoveRowSelectionCommandHandlerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/MoveRowSelectionCommandHandlerTest.java index cac387dc..ce39e948 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/MoveRowSelectionCommandHandlerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/MoveRowSelectionCommandHandlerTest.java @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.Serializable; import java.util.Arrays; @@ -31,16 +31,16 @@ import org.eclipse.nebula.widgets.nattable.selection.command.MoveSelectionComman import org.eclipse.nebula.widgets.nattable.selection.command.SelectRowsCommand; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; import org.eclipse.swt.graphics.Rectangle; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class MoveRowSelectionCommandHandlerTest { private SelectionLayer selectionLayer; private ViewportLayer viewportLayer; - @Before + @BeforeEach public void setUp() { // only use 10 columns to make the test cases easier String[] propertyNames = Arrays.copyOfRange(RowDataListFixture.getPropertyNames(), 0, 10); @@ -68,7 +68,7 @@ public class MoveRowSelectionCommandHandlerTest { this.viewportLayer.setClientAreaProvider(() -> new Rectangle(0, 0, 600, 200)); } - @After + @AfterEach public void cleanUp() { this.selectionLayer.clear(); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/PreserveSelectionModelStructuralChangeEventHandlerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/PreserveSelectionModelStructuralChangeEventHandlerTest.java index 253c67cf..6da451c1 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/PreserveSelectionModelStructuralChangeEventHandlerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/PreserveSelectionModelStructuralChangeEventHandlerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2020 Dirk Fauth and others. + * Copyright (c) 2014, 2022 Dirk Fauth and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.io.Serializable; import java.util.Collection; @@ -41,8 +41,8 @@ import org.eclipse.nebula.widgets.nattable.selection.command.SelectRowsCommand; import org.eclipse.nebula.widgets.nattable.selection.preserve.PreserveSelectionModel; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class PreserveSelectionModelStructuralChangeEventHandlerTest { @@ -52,7 +52,7 @@ public class PreserveSelectionModelStructuralChangeEventHandlerTest { private DataLayer bodyDataLayer; private SelectionLayer selectionLayer; - @Before + @BeforeEach public void setup() { this.listFixture = RowDataListFixture.getList(10); this.bodyDataProvider = new ListDataProvider<RowDataFixture>(this.listFixture, @@ -181,8 +181,8 @@ public class PreserveSelectionModelStructuralChangeEventHandlerTest { } } } - assertTrue("B Ford Motor not found", fordFound); - assertTrue("A Alphabet Co. not found", alphabetFound); + assertTrue(fordFound, "B Ford Motor not found"); + assertTrue(alphabetFound, "A Alphabet Co. not found"); this.listFixture.remove(0); @@ -218,7 +218,7 @@ public class PreserveSelectionModelStructuralChangeEventHandlerTest { // row count of 1 for NatTable because of header assertEquals(1, this.nattable.getRowCount()); assertEquals(0, this.selectionLayer.getSelectedRowCount()); - assertTrue("selection model is not empty", this.selectionLayer.getSelectionModel().getSelections().isEmpty()); + assertTrue(this.selectionLayer.getSelectionModel().getSelections().isEmpty(), "selection model is not empty"); } @Test @@ -243,12 +243,12 @@ public class PreserveSelectionModelStructuralChangeEventHandlerTest { // row count of 1 for NatTable because of header assertEquals(1, this.nattable.getRowCount()); assertEquals(0, this.selectionLayer.getSelectedRowCount()); - assertTrue("selection model is not empty", this.selectionLayer.getSelectionModel().getSelections().isEmpty()); + assertTrue(this.selectionLayer.getSelectionModel().getSelections().isEmpty(), "selection model is not empty"); } @Test public void shouldRemoveCellSelectionOnRowDelete() { - assertTrue("selection is not empty", this.selectionLayer.getSelectedCells().isEmpty()); + assertTrue(this.selectionLayer.getSelectedCells().isEmpty(), "selection is not empty"); this.nattable.doCommand(new SelectCellCommand(this.nattable, 1, 1, false, false)); assertEquals(1, this.selectionLayer.getSelectedCells().size()); @@ -267,7 +267,7 @@ public class PreserveSelectionModelStructuralChangeEventHandlerTest { @Test public void shouldRemovePartialCellSelectionOnRowDelete() { - assertTrue("selection is not empty", this.selectionLayer.getSelectedCells().isEmpty()); + assertTrue(this.selectionLayer.getSelectedCells().isEmpty(), "selection is not empty"); this.nattable.doCommand(new SelectCellCommand(this.nattable, 1, 1, false, false)); assertEquals(1, this.selectionLayer.getSelectedCells().size()); @@ -295,7 +295,7 @@ public class PreserveSelectionModelStructuralChangeEventHandlerTest { @Test public void shouldRemoveCellSelectionOnColumnDelete() { - assertTrue("selection is not empty", this.selectionLayer.getSelectedCells().isEmpty()); + assertTrue(this.selectionLayer.getSelectedCells().isEmpty(), "selection is not empty"); this.nattable.doCommand(new SelectCellCommand(this.nattable, 1, 1, false, false)); assertEquals(1, this.selectionLayer.getSelectedCells().size()); @@ -311,7 +311,7 @@ public class PreserveSelectionModelStructuralChangeEventHandlerTest { @Test public void shouldRemovePartialCellSelectionOnColumnDelete() { - assertTrue("selection is not empty", this.selectionLayer.getSelectedCells().isEmpty()); + assertTrue(this.selectionLayer.getSelectedCells().isEmpty(), "selection is not empty"); this.nattable.doCommand(new SelectCellCommand(this.nattable, 1, 1, false, false)); assertEquals(1, this.selectionLayer.getSelectedCells().size()); @@ -350,7 +350,7 @@ public class PreserveSelectionModelStructuralChangeEventHandlerTest { @Test public void shouldRemovePartialSplitCellSelectionOnColumnDelete() { - assertTrue("selection is not empty", this.selectionLayer.getSelectedCells().isEmpty()); + assertTrue(this.selectionLayer.getSelectedCells().isEmpty(), "selection is not empty"); this.nattable.doCommand(new SelectCellCommand(this.nattable, 1, 1, false, false)); assertEquals(1, this.selectionLayer.getSelectedCells().size()); @@ -369,7 +369,7 @@ public class PreserveSelectionModelStructuralChangeEventHandlerTest { } for (int i = 0; i < found.length; i++) { - assertTrue("columnPosition " + i + " not selected", found[i]); + assertTrue(found[i], "columnPosition " + i + " not selected"); } this.nattable.doCommand(new MultiColumnHideCommand(this.nattable, new int[] { 2, 4 })); @@ -385,7 +385,7 @@ public class PreserveSelectionModelStructuralChangeEventHandlerTest { } for (int i = 0; i < found.length; i++) { - assertTrue("columnPosition " + i + " not selected", found[i]); + assertTrue(found[i], "columnPosition " + i + " not selected"); } // insert again to verify the column position shift @@ -405,7 +405,7 @@ public class PreserveSelectionModelStructuralChangeEventHandlerTest { for (int i = 0; i < found.length; i++) { if (i == 0 || i == 2 || i == 4) { - assertTrue("columnPosition " + i + " not selected", found[i]); + assertTrue(found[i], "columnPosition " + i + " not selected"); } } } @@ -415,7 +415,7 @@ public class PreserveSelectionModelStructuralChangeEventHandlerTest { // integration test case for drag/shift selection // not really a test case for structural changes but important for // selection interactions - assertTrue("selection is not empty", this.selectionLayer.getSelectedCells().isEmpty()); + assertTrue(this.selectionLayer.getSelectedCells().isEmpty(), "selection is not empty"); this.nattable.doCommand(new SelectCellCommand(this.nattable, 3, 3, false, false)); assertEquals(1, this.selectionLayer.getSelectedCells().size()); @@ -435,7 +435,7 @@ public class PreserveSelectionModelStructuralChangeEventHandlerTest { } for (int i = 0; i < found.length; i++) { - assertTrue("columnPosition " + (i + 3) + " not selected", found[i]); + assertTrue(found[i], "columnPosition " + (i + 3) + " not selected"); } this.nattable.doCommand(new SelectCellCommand(this.nattable, 1, 1, true, false)); @@ -452,7 +452,7 @@ public class PreserveSelectionModelStructuralChangeEventHandlerTest { } for (int i = 0; i < found.length; i++) { - assertTrue("columnPosition " + i + " not selected", found[i]); + assertTrue(found[i], "columnPosition " + i + " not selected"); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RangeTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RangeTest.java index 4dbf4f33..9ece6687 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RangeTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RangeTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.ArrayList; import java.util.Arrays; @@ -22,7 +22,7 @@ import java.util.HashSet; import java.util.Set; import org.eclipse.nebula.widgets.nattable.coordinate.Range; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class RangeTest { @@ -89,6 +89,6 @@ public class RangeTest { assertEquals(7, members.length); int[] expectedMembes = new int[] { 3, 4, 5, 6, 7, 8, 9 }; - assertTrue("Expected member array is not the same as the returned member array", Arrays.equals(expectedMembes, members)); + assertTrue(Arrays.equals(expectedMembes, members), "Expected member array is not the same as the returned member array"); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RegionSelectionTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RegionSelectionTest.java index c33fa0b8..517f6eda 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RegionSelectionTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RegionSelectionTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2020 Dirk Fauth. + * Copyright (c) 2018, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,28 +12,28 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate; import org.eclipse.nebula.widgets.nattable.selection.command.SelectRegionCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.swt.graphics.Rectangle; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RegionSelectionTest { private SelectionLayer selectionLayer; - @Before + @BeforeEach public void setUp() { this.selectionLayer = new SelectionLayer(new DataLayerFixture(10, 10, 100, 20)); } - @After + @AfterEach public void cleanUp() { this.selectionLayer.clear(); } @@ -47,10 +47,10 @@ public class RegionSelectionTest { assertEquals(9, cellPositions.length); Rectangle region = new Rectangle(2, 3, 3, 3); - assertTrue("not all cells in region selected", this.selectionLayer.allCellsSelectedInRegion(region)); + assertTrue(this.selectionLayer.allCellsSelectedInRegion(region), "not all cells in region selected"); region = new Rectangle(1, 1, 2, 2); - assertFalse("all cells selected", this.selectionLayer.allCellsSelectedInRegion(region)); + assertFalse(this.selectionLayer.allCellsSelectedInRegion(region), "all cells selected"); assertEquals(2, this.selectionLayer.getSelectionAnchor().getColumnPosition()); assertEquals(3, this.selectionLayer.getSelectionAnchor().getRowPosition()); @@ -68,10 +68,10 @@ public class RegionSelectionTest { assertEquals(4, cellPositions.length); Rectangle region = new Rectangle(1, 2, 2, 2); - assertTrue("not all cells in region selected", this.selectionLayer.allCellsSelectedInRegion(region)); + assertTrue(this.selectionLayer.allCellsSelectedInRegion(region), "not all cells in region selected"); region = new Rectangle(2, 3, 3, 3); - assertFalse("all cells selected", this.selectionLayer.allCellsSelectedInRegion(region)); + assertFalse(this.selectionLayer.allCellsSelectedInRegion(region), "all cells selected"); assertEquals(1, this.selectionLayer.getSelectionAnchor().getColumnPosition()); assertEquals(2, this.selectionLayer.getSelectionAnchor().getRowPosition()); @@ -89,7 +89,7 @@ public class RegionSelectionTest { assertEquals(18, cellPositions.length); Rectangle region = new Rectangle(2, 3, 3, 6); - assertTrue("not all cells in region selected", this.selectionLayer.allCellsSelectedInRegion(region)); + assertTrue(this.selectionLayer.allCellsSelectedInRegion(region), "not all cells in region selected"); assertEquals(2, this.selectionLayer.getSelectionAnchor().getColumnPosition()); assertEquals(3, this.selectionLayer.getSelectionAnchor().getRowPosition()); @@ -107,7 +107,7 @@ public class RegionSelectionTest { assertEquals(12, cellPositions.length); Rectangle region = new Rectangle(2, 0, 3, 3); - assertTrue("not all cells in region selected", this.selectionLayer.allCellsSelectedInRegion(region)); + assertTrue(this.selectionLayer.allCellsSelectedInRegion(region), "not all cells in region selected"); assertEquals(2, this.selectionLayer.getSelectionAnchor().getColumnPosition()); assertEquals(3, this.selectionLayer.getSelectionAnchor().getRowPosition()); @@ -125,7 +125,7 @@ public class RegionSelectionTest { assertEquals(18, cellPositions.length); Rectangle region = new Rectangle(2, 3, 6, 3); - assertTrue("not all cells in region selected", this.selectionLayer.allCellsSelectedInRegion(region)); + assertTrue(this.selectionLayer.allCellsSelectedInRegion(region), "not all cells in region selected"); assertEquals(2, this.selectionLayer.getSelectionAnchor().getColumnPosition()); assertEquals(3, this.selectionLayer.getSelectionAnchor().getRowPosition()); @@ -143,7 +143,7 @@ public class RegionSelectionTest { assertEquals(9, cellPositions.length); Rectangle region = new Rectangle(0, 3, 3, 3); - assertTrue("not all cells in region selected", this.selectionLayer.allCellsSelectedInRegion(region)); + assertTrue(this.selectionLayer.allCellsSelectedInRegion(region), "not all cells in region selected"); assertEquals(2, this.selectionLayer.getSelectionAnchor().getColumnPosition()); assertEquals(3, this.selectionLayer.getSelectionAnchor().getRowPosition()); @@ -161,13 +161,13 @@ public class RegionSelectionTest { assertEquals(12, cellPositions.length); Rectangle region = new Rectangle(2, 3, 3, 3); - assertTrue("not all cells in region selected", this.selectionLayer.allCellsSelectedInRegion(region)); + assertTrue(this.selectionLayer.allCellsSelectedInRegion(region), "not all cells in region selected"); region = new Rectangle(2, 7, 3, 1); - assertTrue("not all cells in region selected", this.selectionLayer.allCellsSelectedInRegion(region)); + assertTrue(this.selectionLayer.allCellsSelectedInRegion(region), "not all cells in region selected"); region = new Rectangle(2, 3, 3, 5); - assertFalse("all cells in region selected", this.selectionLayer.allCellsSelectedInRegion(region)); + assertFalse(this.selectionLayer.allCellsSelectedInRegion(region), "all cells in region selected"); assertEquals(2, this.selectionLayer.getSelectionAnchor().getColumnPosition()); assertEquals(7, this.selectionLayer.getSelectionAnchor().getRowPosition()); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RowSelectionModelStructuralChangeEventHandlerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RowSelectionModelStructuralChangeEventHandlerTest.java index e8726da4..9f599b2d 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RowSelectionModelStructuralChangeEventHandlerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RowSelectionModelStructuralChangeEventHandlerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2020 Dirk Fauth and others. + * Copyright (c) 2014, 2022 Dirk Fauth and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.Serializable; import java.util.List; @@ -35,8 +35,8 @@ import org.eclipse.nebula.widgets.nattable.selection.event.RowSelectionEvent; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowSelectionModelStructuralChangeEventHandlerTest { @@ -48,7 +48,7 @@ public class RowSelectionModelStructuralChangeEventHandlerTest { private LayerListenerFixture listener; - @Before + @BeforeEach public void setup() { this.listFixture = RowDataListFixture.getList(10); this.bodyDataProvider = new ListDataProvider<RowDataFixture>(this.listFixture, @@ -180,8 +180,8 @@ public class RowSelectionModelStructuralChangeEventHandlerTest { } } } - assertTrue("B Ford Motor not found", fordFound); - assertTrue("A Alphabet Co. not found", alphabetFound); + assertTrue(fordFound, "B Ford Motor not found"); + assertTrue(alphabetFound, "A Alphabet Co. not found"); this.listFixture.remove(0); @@ -217,7 +217,7 @@ public class RowSelectionModelStructuralChangeEventHandlerTest { // row count of 1 for NatTable because of header assertEquals(1, this.nattable.getRowCount()); assertEquals(0, this.selectionLayer.getSelectedRowCount()); - assertTrue("selection model is not empty", this.selectionLayer.getSelectionModel().getSelections().isEmpty()); + assertTrue(this.selectionLayer.getSelectionModel().getSelections().isEmpty(), "selection model is not empty"); } @Test @@ -242,7 +242,7 @@ public class RowSelectionModelStructuralChangeEventHandlerTest { // row count of 1 for NatTable because of header assertEquals(1, this.nattable.getRowCount()); assertEquals(0, this.selectionLayer.getSelectedRowCount()); - assertTrue("selection model is not empty", this.selectionLayer.getSelectionModel().getSelections().isEmpty()); + assertTrue(this.selectionLayer.getSelectionModel().getSelections().isEmpty(), "selection model is not empty"); } @Test diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RowSelectionTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RowSelectionTest.java index 67ff6cb4..2f41c7bc 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RowSelectionTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RowSelectionTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Collection; @@ -23,23 +23,23 @@ import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand; import org.eclipse.nebula.widgets.nattable.selection.command.SelectRowsCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.util.ArrayUtil; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowSelectionTest { // Tests for column selection NTBL-225 private SelectionLayer selectionLayer; - @Before + @BeforeEach public void setUp() { this.selectionLayer = new SelectionLayer(new DataLayerFixture()); // Selection grid origin as starting point this.selectionLayer.setSelectedCell(0, 0); } - @After + @AfterEach public void cleanUp() { this.selectionLayer.clear(); } @@ -133,9 +133,9 @@ public class RowSelectionTest { assertEquals(0, this.selectionLayer.getSelectionAnchor().getColumnPosition()); assertEquals(4, this.selectionLayer.getSelectionAnchor().getRowPosition()); - assertFalse("row 3 fully selected", this.selectionLayer.isRowPositionFullySelected(3)); - assertTrue("row 4 not fully selected", this.selectionLayer.isRowPositionFullySelected(4)); - assertFalse("row 5 fully selected", this.selectionLayer.isRowPositionFullySelected(5)); + assertFalse(this.selectionLayer.isRowPositionFullySelected(3), "row 3 fully selected"); + assertTrue(this.selectionLayer.isRowPositionFullySelected(4), "row 4 not fully selected"); + assertFalse(this.selectionLayer.isRowPositionFullySelected(5), "row 5 fully selected"); } @Test @@ -147,25 +147,24 @@ public class RowSelectionTest { this.selectionLayer.doCommand(new SelectRowsCommand(this.selectionLayer, 0, 2, true, false)); for (int row = 2; row <= 4; row++) { - assertTrue("row " + row + " not fully selected", this.selectionLayer.isRowPositionFullySelected(row)); + assertTrue(this.selectionLayer.isRowPositionFullySelected(row), "row " + row + " not fully selected"); } - assertFalse("row 5 fully selected", this.selectionLayer.isRowPositionFullySelected(5)); + assertFalse(this.selectionLayer.isRowPositionFullySelected(5), "row 5 fully selected"); // select rows to the bottom this.selectionLayer.doCommand(new SelectRowsCommand(this.selectionLayer, 0, 6, true, false)); - assertFalse("row 2 fully selected", this.selectionLayer.isRowPositionFullySelected(2)); - assertFalse("row 3 fully selected", this.selectionLayer.isRowPositionFullySelected(3)); + assertFalse(this.selectionLayer.isRowPositionFullySelected(2), "row 2 fully selected"); + assertFalse(this.selectionLayer.isRowPositionFullySelected(3), "row 3 fully selected"); for (int row = 4; row <= 6; row++) { - assertTrue("row " + row + " not fully selected", this.selectionLayer.isRowPositionFullySelected(row)); + assertTrue(this.selectionLayer.isRowPositionFullySelected(row), "row " + row + " not fully selected"); } } private void assertCellsSelectedBetween(int startRowPosition, int endRowPosition) { for (int row = startRowPosition; row <= endRowPosition; row++) { for (int col = 0; col <= 4; col++) { - assertTrue("[" + col + ", " + row + "] not selected", - this.selectionLayer.isCellPositionSelected(col, row)); + assertTrue(this.selectionLayer.isCellPositionSelected(col, row), "[" + col + ", " + row + "] not selected"); } } } @@ -285,7 +284,7 @@ public class RowSelectionTest { assertEquals(2, this.selectionLayer.getSelectionAnchor().getRowPosition()); for (int row = 2; row <= 4; row++) { - assertTrue("row " + row + " not fully selected", this.selectionLayer.isRowPositionFullySelected(row)); + assertTrue(this.selectionLayer.isRowPositionFullySelected(row), "row " + row + " not fully selected"); } // deselect row 2 @@ -294,9 +293,9 @@ public class RowSelectionTest { assertEquals(0, this.selectionLayer.getSelectionAnchor().getColumnPosition()); assertEquals(3, this.selectionLayer.getSelectionAnchor().getRowPosition()); - assertFalse("row 2 fully selected", this.selectionLayer.isRowPositionFullySelected(2)); + assertFalse(this.selectionLayer.isRowPositionFullySelected(2), "row 2 fully selected"); for (int row = 3; row <= 4; row++) { - assertTrue("row " + row + " not fully selected", this.selectionLayer.isRowPositionFullySelected(row)); + assertTrue(this.selectionLayer.isRowPositionFullySelected(row), "row " + row + " not fully selected"); } } @@ -318,8 +317,8 @@ public class RowSelectionTest { assertEquals(0, this.selectionLayer.getSelectionAnchor().getColumnPosition()); assertEquals(4, this.selectionLayer.getSelectionAnchor().getRowPosition()); - assertFalse("[0, 2] is selected", this.selectionLayer.isCellPositionSelected(0, 2)); - assertTrue("row 4 not fully selected", this.selectionLayer.isRowPositionFullySelected(4)); + assertFalse(this.selectionLayer.isCellPositionSelected(0, 2), "[0, 2] is selected"); + assertTrue(this.selectionLayer.isRowPositionFullySelected(4), "row 4 not fully selected"); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RowSelectionTraversalTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RowSelectionTraversalTest.java index 054f0882..05dc0f90 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RowSelectionTraversalTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RowSelectionTraversalTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2020 Dirk Fauth. + * Copyright (c) 2014, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.Serializable; import java.util.Arrays; @@ -27,16 +27,16 @@ import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer.MoveDirectionEnum; import org.eclipse.nebula.widgets.nattable.selection.command.MoveSelectionCommand; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowSelectionTraversalTest { private SelectionLayer selectionLayer; private ViewportLayer viewportLayer; - @Before + @BeforeEach public void setUp() { // only use 10 columns to make the test cases easier String[] propertyNames = Arrays.copyOfRange(RowDataListFixture.getPropertyNames(), 0, 10); @@ -61,7 +61,7 @@ public class RowSelectionTraversalTest { this.viewportLayer = new ViewportLayer(this.selectionLayer); } - @After + @AfterEach public void cleanUp() { this.selectionLayer.clear(); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectAllTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectAllTest.java index 07204f0e..a0f0cc46 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectAllTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectAllTest.java @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.Serializable; import java.util.Arrays; @@ -40,7 +40,7 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class SelectAllTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectionLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectionLayerTest.java index 6ede8d33..f8b2ec92 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectionLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectionLayerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -17,12 +17,12 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Map; @@ -34,15 +34,15 @@ import org.eclipse.nebula.widgets.nattable.layer.event.IStructuralChangeEvent; import org.eclipse.nebula.widgets.nattable.test.LayerAssert; import org.eclipse.nebula.widgets.nattable.test.fixture.TestLayer; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class SelectionLayerTest { private TestLayer testLayer; private TestSelectionLayer selectionLayer; - @Before + @BeforeEach public void setup() { String columnInfo = "0:0;100 | 1:1;100 | 2:2;100 | 3:3;100"; String rowInfo = "0:0;40 | 1:1;40 | 2:2;40 | 3:3;40"; diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectionModelStructuralChangeEventHandlerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectionModelStructuralChangeEventHandlerTest.java index 3de9ede5..f84ca4e5 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectionModelStructuralChangeEventHandlerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectionModelStructuralChangeEventHandlerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2020 Original authors and others. + * Copyright (c) 2014, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; @@ -36,8 +36,8 @@ import org.eclipse.nebula.widgets.nattable.selection.command.SelectRowsCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class SelectionModelStructuralChangeEventHandlerTest { @@ -45,7 +45,7 @@ public class SelectionModelStructuralChangeEventHandlerTest { private DataLayerFixture dataLayer; private SelectionLayer selectionLayer; - @Before + @BeforeEach public void setup() { this.dataLayer = new DataLayerFixture(10, 10); DefaultBodyLayerStack bodyLayer = new DefaultBodyLayerStack(this.dataLayer); @@ -206,8 +206,8 @@ public class SelectionModelStructuralChangeEventHandlerTest { // row count of 1 for NatTable because of header assertEquals(1, nattable.getRowCount()); - assertTrue("selection is not empty", selectionLayer.getSelectedCells().isEmpty()); - assertTrue("selection model is not empty", selectionLayer.getSelectionModel().getSelections().isEmpty()); + assertTrue(selectionLayer.getSelectedCells().isEmpty(), "selection is not empty"); + assertTrue(selectionLayer.getSelectionModel().getSelections().isEmpty(), "selection model is not empty"); } @Test @@ -243,8 +243,8 @@ public class SelectionModelStructuralChangeEventHandlerTest { // row count of 1 for NatTable because of header assertEquals(1, nattable.getRowCount()); - assertTrue("selection is not empty", selectionLayer.getSelectedCells().isEmpty()); - assertTrue("selection model is not empty", selectionLayer.getSelectionModel().getSelections().isEmpty()); + assertTrue(selectionLayer.getSelectedCells().isEmpty(), "selection is not empty"); + assertTrue(selectionLayer.getSelectionModel().getSelections().isEmpty(), "selection model is not empty"); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectionModelTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectionModelTest.java index bf972adb..22126a25 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectionModelTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectionModelTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.ArrayList; import java.util.Arrays; @@ -24,15 +24,14 @@ import org.eclipse.nebula.widgets.nattable.coordinate.Range; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.util.ObjectUtils; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class SelectionModelTest { private SelectionModel model; - @Before + @BeforeEach public void before() { SelectionLayer selectionLayer = new SelectionLayer( new DataLayerFixture(100, 100, 100, 40)); @@ -41,20 +40,18 @@ public class SelectionModelTest { @Test public void isCellSelected() { - assertFalse("Empty model should have no selection.", - this.model.isCellPositionSelected(0, 0)); + assertFalse(this.model.isCellPositionSelected(0, 0), "Empty model should have no selection."); } @Test public void addCellSelection() { this.model.addSelection(0, 0); - assertTrue("Failed to add selection.", - this.model.isCellPositionSelected(0, 0)); + assertTrue(this.model.isCellPositionSelected(0, 0), "Failed to add selection."); } @Test - public void isColumnFullySelected() throws Exception { + public void isColumnFullySelected() { this.model.addSelection(new Rectangle(3, 0, 10, 10)); assertFalse(this.model.isColumnPositionFullySelected(3, 11)); @@ -65,7 +62,7 @@ public class SelectionModelTest { } @Test - public void isColumnFullySelectedForContiguousRectangles() throws Exception { + public void isColumnFullySelectedForContiguousRectangles() { this.model.addSelection(new Rectangle(0, 0, 10, 10)); this.model.addSelection(new Rectangle(5, 10, 10, 10)); @@ -73,8 +70,7 @@ public class SelectionModelTest { } @Test - public void isColumnFullySelectedForNonContiguousRectangles() - throws Exception { + public void isColumnFullySelectedForNonContiguousRectangles() { this.model.addSelection(new Rectangle(0, 0, 10, 10)); this.model.addSelection(new Rectangle(5, 5, 10, 8)); this.model.addSelection(new Rectangle(5, 15, 10, 5)); @@ -83,7 +79,7 @@ public class SelectionModelTest { } @Test - public void isColumnFullySelectedForOverlapingRectangles() throws Exception { + public void isColumnFullySelectedForOverlapingRectangles() { this.model.addSelection(new Rectangle(0, 0, 10, 10)); this.model.addSelection(new Rectangle(5, 5, 10, 8)); @@ -91,8 +87,7 @@ public class SelectionModelTest { } @Test - public void isColumnFullySelectedWhenIndividualCellsSelected() - throws Exception { + public void isColumnFullySelectedWhenIndividualCellsSelected() { this.model.addSelection(new Rectangle(1, 5, 1, 1)); this.model.addSelection(new Rectangle(1, 10, 1, 1)); @@ -100,7 +95,7 @@ public class SelectionModelTest { } @Test - public void isColumnFullySelectedWhenLastCellSelected() throws Exception { + public void isColumnFullySelectedWhenLastCellSelected() { this.model.addSelection(new Rectangle(1, 5, 1, 1)); assertFalse(this.model.isColumnPositionFullySelected(1, 6)); @@ -108,14 +103,13 @@ public class SelectionModelTest { } @Test - public void isRowFullySelected() throws Exception { + public void isRowFullySelected() { this.model.addSelection(new Rectangle(0, 3, 10, 10)); assertTrue(this.model.isRowPositionFullySelected(3, 10)); } @Test - public void isRowFullySelectedWhenMultipleRowsAndColumnsAreSelected() - throws Exception { + public void isRowFullySelectedWhenMultipleRowsAndColumnsAreSelected() { // Rows 3, 6 fully selected this.model.addSelection(new Rectangle(0, 3, 10, 1)); this.model.addSelection(new Rectangle(0, 6, 10, 1)); @@ -139,25 +133,22 @@ public class SelectionModelTest { } @Test - public void isRowNotFullySelected() throws Exception { + public void isRowNotFullySelected() { this.model.addSelection(new Rectangle(0, 3, 10, 10)); assertFalse(this.model.isRowPositionFullySelected(3, 11)); } @Test - public void contains() throws Exception { - assertTrue(this.model.contains(new Rectangle(0, 0, 10, 10), new Rectangle(1, - 1, 5, 5))); - assertTrue(this.model.contains(new Rectangle(0, 0, 10, 1), new Rectangle(5, - 0, 1, 1))); + public void contains() { + assertTrue(this.model.contains(new Rectangle(0, 0, 10, 10), new Rectangle(1, 1, 5, 5))); + assertTrue(this.model.contains(new Rectangle(0, 0, 10, 1), new Rectangle(5, 0, 1, 1))); - assertFalse(this.model.contains(new Rectangle(0, 6, 0, 0), new Rectangle(2, - 6, 1, 1))); + assertFalse(this.model.contains(new Rectangle(0, 6, 0, 0), new Rectangle(2, 6, 1, 1))); } @Test - public void isMltipleCol() throws Exception { + public void isMltipleCol() { this.model.addSelection(new Rectangle(1, 0, 1, 20)); this.model.addSelection(new Rectangle(2, 0, 1, 20)); this.model.addSelection(new Rectangle(3, 0, 1, 20)); @@ -167,30 +158,30 @@ public class SelectionModelTest { } @Test - public void shouldReturnListOfFullySelectedColumns() throws Exception { + public void shouldReturnListOfFullySelectedColumns() { this.model.addSelection(new Rectangle(1, 0, 1, 20)); this.model.addSelection(new Rectangle(2, 10, 1, 4)); this.model.addSelection(new Rectangle(3, 0, 1, 20)); int[] fullySelectedColumns = this.model.getFullySelectedColumnPositions(20); - Assert.assertEquals(2, fullySelectedColumns.length); - Assert.assertEquals(1, fullySelectedColumns[0]); - Assert.assertEquals(3, fullySelectedColumns[1]); + assertEquals(2, fullySelectedColumns.length); + assertEquals(1, fullySelectedColumns[0]); + assertEquals(3, fullySelectedColumns[1]); } @Test - public void shouldReturnListOfFullySelectedRows() throws Exception { + public void shouldReturnListOfFullySelectedRows() { int[] fullySelectedRows = this.model.getFullySelectedRowPositions(20); - Assert.assertEquals(0, fullySelectedRows.length); + assertEquals(0, fullySelectedRows.length); this.model.addSelection(new Rectangle(0, 1, 20, 1)); this.model.addSelection(new Rectangle(3, 2, 4, 1)); this.model.addSelection(new Rectangle(0, 3, 20, 1)); fullySelectedRows = this.model.getFullySelectedRowPositions(20); - Assert.assertEquals(2, fullySelectedRows.length); - Assert.assertEquals(1, fullySelectedRows[0]); - Assert.assertEquals(3, fullySelectedRows[1]); + assertEquals(2, fullySelectedRows.length); + assertEquals(1, fullySelectedRows[0]); + assertEquals(3, fullySelectedRows[1]); } @Test @@ -204,9 +195,8 @@ public class SelectionModelTest { for (int row = 0; row < 3; row++) { for (int col = 0; col < 3; col++) { - assertTrue( - "Failed to add selection [" + row + ", " + col + "]", - this.model.isCellPositionSelected(col, row)); + assertTrue(this.model.isCellPositionSelected(col, row), + "Failed to add selection [" + row + ", " + col + "]"); } } @@ -218,27 +208,17 @@ public class SelectionModelTest { this.model.addSelection(2, 0); this.model.addSelection(0, 2); - assertTrue("Failed to add selection [0, 0]", - this.model.isCellPositionSelected(0, 0)); - assertTrue("Failed to add selection [0, 2]", - this.model.isCellPositionSelected(2, 0)); - assertTrue("Failed to add selection [2, 0]", - this.model.isCellPositionSelected(0, 2)); - - assertFalse("Added too many cells to the range", - this.model.isCellPositionSelected(1, 0)); - assertFalse("Added too many cells to the range", - this.model.isCellPositionSelected(0, 1)); - assertFalse("Added too many cells to the range", - this.model.isCellPositionSelected(1, 1)); - assertFalse("Added too many cells to the range", - this.model.isCellPositionSelected(2, 1)); - assertFalse("Added too many cells to the range", - this.model.isCellPositionSelected(1, 2)); - assertFalse("Added too many cells to the range", - this.model.isCellPositionSelected(2, 2)); - assertFalse("Added too many cells to the range", - this.model.isCellPositionSelected(3, 3)); + assertTrue(this.model.isCellPositionSelected(0, 0), "Failed to add selection [0, 0]"); + assertTrue(this.model.isCellPositionSelected(2, 0), "Failed to add selection [0, 2]"); + assertTrue(this.model.isCellPositionSelected(0, 2), "Failed to add selection [2, 0]"); + + assertFalse(this.model.isCellPositionSelected(1, 0), "Added too many cells to the range"); + assertFalse(this.model.isCellPositionSelected(0, 1), "Added too many cells to the range"); + assertFalse(this.model.isCellPositionSelected(1, 1), "Added too many cells to the range"); + assertFalse(this.model.isCellPositionSelected(2, 1), "Added too many cells to the range"); + assertFalse(this.model.isCellPositionSelected(1, 2), "Added too many cells to the range"); + assertFalse(this.model.isCellPositionSelected(2, 2), "Added too many cells to the range"); + assertFalse(this.model.isCellPositionSelected(3, 3), "Added too many cells to the range"); } @Test @@ -247,8 +227,7 @@ public class SelectionModelTest { this.model.clearSelection(); - assertFalse("Failed to clear selection", - this.model.isCellPositionSelected(0, 0)); + assertFalse(this.model.isCellPositionSelected(0, 0), "Failed to clear selection"); } @Test @@ -261,13 +240,12 @@ public class SelectionModelTest { for (int rowIndex = row; rowIndex < row + numRows; rowIndex++) { for (int colIndex = col; colIndex < col + numCols; colIndex++) { - assertTrue("Failed to add range [" + rowIndex + ", " + colIndex - + "]", this.model.isCellPositionSelected(colIndex, rowIndex)); + assertTrue(this.model.isCellPositionSelected(colIndex, rowIndex), + "Failed to add range [" + rowIndex + ", " + colIndex + "]"); } } - assertFalse("Added too many cells from range", - this.model.isCellPositionSelected(col, row + numRows)); + assertFalse(this.model.isCellPositionSelected(col, row + numRows), "Added too many cells from range"); } @Test @@ -282,8 +260,7 @@ public class SelectionModelTest { this.model.addSelection(0, 0); this.model.clearSelection(0, 0); - assertFalse("Failed to remove selection [0, 0].", - this.model.isCellPositionSelected(0, 0)); + assertFalse(this.model.isCellPositionSelected(0, 0), "Failed to remove selection [0, 0]."); } @Test @@ -294,46 +271,43 @@ public class SelectionModelTest { this.model.addSelection(2, 3); this.model.clearSelection(1, 1); - assertFalse("Failed to remove selection [1, 1].", - this.model.isCellPositionSelected(1, 1)); + assertFalse(this.model.isCellPositionSelected(1, 1), "Failed to remove selection [1, 1]."); } - private void removeSingleCellFromRange(int col, int row, int numCols, - int numRows, int removedRow, int removedColumn) { + private void removeSingleCellFromRange( + int col, int row, int numCols, int numRows, + int removedRow, int removedColumn) { + this.model.addSelection(new Rectangle(col, row, numCols, numRows)); this.model.clearSelection(removedColumn, removedRow); - assertFalse("Failed to remove selection [" + removedRow + ", " - + removedColumn + "]", - this.model.isCellPositionSelected(removedColumn, removedRow)); + assertFalse(this.model.isCellPositionSelected(removedColumn, removedRow), + "Failed to remove selection [" + removedRow + ", " + removedColumn + "]"); for (int rowIndex = row; rowIndex < row + numRows; rowIndex++) { for (int colIndex = col; colIndex < col + numCols; colIndex++) { if (!(rowIndex == removedRow && colIndex == removedColumn)) - assertTrue("Failed to add range [" + rowIndex + ", " - + colIndex + "]", - this.model.isCellPositionSelected(colIndex, rowIndex)); + assertTrue(this.model.isCellPositionSelected(colIndex, rowIndex), + "Failed to add range [" + rowIndex + ", " + colIndex + "]"); } } } - private void removeRangeFromRange(int col, int row, int numCols, - int numRows, int removedRow, int removedColumn, int removedNumCols, - int removedNumRows) { + private void removeRangeFromRange( + int col, int row, int numCols, int numRows, + int removedRow, int removedColumn, int removedNumCols, int removedNumRows) { this.model.addSelection(new Rectangle(col, row, numCols, numRows)); - Rectangle removedSelection = new Rectangle(removedColumn, removedRow, - removedNumCols, removedNumRows); + Rectangle removedSelection = new Rectangle(removedColumn, removedRow, removedNumCols, removedNumRows); this.model.clearSelection(removedSelection); for (int rowIndex = removedRow; rowIndex < removedRow + removedNumRows; rowIndex++) { for (int colIndex = removedColumn; colIndex < removedColumn + removedNumCols; colIndex++) { - assertFalse("Failed to remove selection [" + rowIndex + ", " - + colIndex + "]", - this.model.isCellPositionSelected(colIndex, rowIndex)); + assertFalse(this.model.isCellPositionSelected(colIndex, rowIndex), + "Failed to remove selection [" + rowIndex + ", " + colIndex + "]"); } } @@ -341,9 +315,8 @@ public class SelectionModelTest { for (int colIndex = col; colIndex < col + numCols; colIndex++) { if (!removedSelection.contains(colIndex, rowIndex)) - assertTrue("Failed to add range [" + rowIndex + ", " - + colIndex + "]", - this.model.isCellPositionSelected(colIndex, rowIndex)); + assertTrue(this.model.isCellPositionSelected(colIndex, rowIndex), + "Failed to add range [" + rowIndex + ", " + colIndex + "]"); } } } @@ -358,8 +331,7 @@ public class SelectionModelTest { int removedColumn = 2; int removedRow = 3; - removeSingleCellFromRange(col, row, numCols, numRows, removedRow, - removedColumn); + removeSingleCellFromRange(col, row, numCols, numRows, removedRow, removedColumn); } @Test @@ -372,8 +344,7 @@ public class SelectionModelTest { int removedColumn = 2; int removedRow = 3; - removeSingleCellFromRange(col, row, numCols, numRows, removedRow, - removedColumn); + removeSingleCellFromRange(col, row, numCols, numRows, removedRow, removedColumn); } @Test @@ -386,8 +357,7 @@ public class SelectionModelTest { int removedColumn = 11; int removedRow = 3; - removeSingleCellFromRange(col, row, numCols, numRows, removedRow, - removedColumn); + removeSingleCellFromRange(col, row, numCols, numRows, removedRow, removedColumn); } @Test @@ -400,8 +370,7 @@ public class SelectionModelTest { int removedColumn = 8; int removedRow = 3; - removeSingleCellFromRange(col, row, numCols, numRows, removedRow, - removedColumn); + removeSingleCellFromRange(col, row, numCols, numRows, removedRow, removedColumn); } @Test @@ -414,8 +383,7 @@ public class SelectionModelTest { int removedColumn = 2; int removedRow = 3; - removeSingleCellFromRange(col, row, numCols, numRows, removedRow, - removedColumn); + removeSingleCellFromRange(col, row, numCols, numRows, removedRow, removedColumn); } @Test @@ -428,8 +396,7 @@ public class SelectionModelTest { int removedColumn = 2; int removedRow = 12; - removeSingleCellFromRange(col, row, numCols, numRows, removedRow, - removedColumn); + removeSingleCellFromRange(col, row, numCols, numRows, removedRow, removedColumn); } @Test @@ -442,8 +409,7 @@ public class SelectionModelTest { int removedColumn = 2; int removedRow = 7; - removeSingleCellFromRange(col, row, numCols, numRows, removedRow, - removedColumn); + removeSingleCellFromRange(col, row, numCols, numRows, removedRow, removedColumn); } @Test @@ -456,8 +422,7 @@ public class SelectionModelTest { int removedColumn = 2; int removedRow = 3; - removeSingleCellFromRange(col, row, numCols, numRows, removedRow, - removedColumn); + removeSingleCellFromRange(col, row, numCols, numRows, removedRow, removedColumn); } @Test @@ -470,8 +435,7 @@ public class SelectionModelTest { int removedColumn = 4; int removedRow = 3; - removeSingleCellFromRange(col, row, numCols, numRows, removedRow, - removedColumn); + removeSingleCellFromRange(col, row, numCols, numRows, removedRow, removedColumn); } @Test @@ -484,8 +448,7 @@ public class SelectionModelTest { int removedColumn = 3; int removedRow = 3; - removeSingleCellFromRange(col, row, numCols, numRows, removedRow, - removedColumn); + removeSingleCellFromRange(col, row, numCols, numRows, removedRow, removedColumn); } @Test @@ -498,8 +461,7 @@ public class SelectionModelTest { int removedColumn = 2; int removedRow = 6; - removeSingleCellFromRange(col, row, numCols, numRows, removedRow, - removedColumn); + removeSingleCellFromRange(col, row, numCols, numRows, removedRow, removedColumn); } @Test @@ -512,8 +474,7 @@ public class SelectionModelTest { int removedColumn = 4; int removedRow = 6; - removeSingleCellFromRange(col, row, numCols, numRows, removedRow, - removedColumn); + removeSingleCellFromRange(col, row, numCols, numRows, removedRow, removedColumn); } @Test @@ -526,8 +487,7 @@ public class SelectionModelTest { int removedColumn = 3; int removedRow = 6; - removeSingleCellFromRange(col, row, numCols, numRows, removedRow, - removedColumn); + removeSingleCellFromRange(col, row, numCols, numRows, removedRow, removedColumn); } @Test @@ -540,8 +500,7 @@ public class SelectionModelTest { int removedColumn = 2; int removedRow = 5; - removeSingleCellFromRange(col, row, numCols, numRows, removedRow, - removedColumn); + removeSingleCellFromRange(col, row, numCols, numRows, removedRow, removedColumn); } @Test @@ -554,8 +513,7 @@ public class SelectionModelTest { int removedColumn = 4; int removedRow = 5; - removeSingleCellFromRange(col, row, numCols, numRows, removedRow, - removedColumn); + removeSingleCellFromRange(col, row, numCols, numRows, removedRow, removedColumn); } @Test @@ -568,8 +526,7 @@ public class SelectionModelTest { int removedColumn = 3; int removedRow = 5; - removeSingleCellFromRange(col, row, numCols, numRows, removedRow, - removedColumn); + removeSingleCellFromRange(col, row, numCols, numRows, removedRow, removedColumn); } @Test @@ -579,8 +536,7 @@ public class SelectionModelTest { this.model.addSelection(10, 7); this.model.addSelection(new Rectangle(10, 50, 5, 10)); - List<Range> selectedRows = ObjectUtils.asList(this.model - .getSelectedRowPositions()); + List<Range> selectedRows = ObjectUtils.asList(this.model.getSelectedRowPositions()); assertTrue(selectedRows.contains(new Range(1, 3))); assertTrue(selectedRows.contains(new Range(7, 8))); @@ -593,8 +549,7 @@ public class SelectionModelTest { this.model.addSelection(new Rectangle(10, 4, 5, 10)); this.model.addSelection(new Rectangle(10, 20, 5, 10)); - List<Range> selectedRows = ObjectUtils.asList(this.model - .getSelectedRowPositions()); + List<Range> selectedRows = ObjectUtils.asList(this.model.getSelectedRowPositions()); assertEquals(2, selectedRows.size()); assertTrue(selectedRows.contains(new Range(3, 14))); @@ -606,15 +561,14 @@ public class SelectionModelTest { this.model.addSelection(1, 10); this.model.addSelection(new Rectangle(5, 1, 1, 100)); - List<Range> selectedRows = ObjectUtils.asList(this.model - .getSelectedRowPositions()); + List<Range> selectedRows = ObjectUtils.asList(this.model.getSelectedRowPositions()); assertEquals(1, selectedRows.size()); assertTrue(selectedRows.contains(new Range(1, 100))); } @Test - public void getSelectedRowCount() throws Exception { + public void getSelectedRowCount() { this.model.addSelection(new Rectangle(10, 3, 1, 1)); this.model.addSelection(new Rectangle(10, 10, 1, 1)); this.model.addSelection(new Rectangle(10, 5, 1, 20)); @@ -623,7 +577,7 @@ public class SelectionModelTest { } @Test - public void isRowPositionSelected() throws Exception { + public void isRowPositionSelected() { this.model.addSelection(1, 10); this.model.addSelection(new Rectangle(5, 1, 100, 10000000)); @@ -651,12 +605,11 @@ public class SelectionModelTest { Rectangle removedSelection = new Rectangle(0, 0, 10, 10); this.model.clearSelection(removedSelection); - assertTrue("Removal from empty selection failed.", this.model.isEmpty()); + assertTrue(this.model.isEmpty(), "Removal from empty selection failed."); for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { - assertFalse("Selection was not removed [" + i + ", " + j + "]", - this.model.isCellPositionSelected(j, i)); + assertFalse(this.model.isCellPositionSelected(j, i), "Selection was not removed [" + i + ", " + j + "]"); } } } @@ -776,8 +729,8 @@ public class SelectionModelTest { } @Test - public void sortByY() throws Exception { - List<Rectangle> rectangles = new ArrayList<Rectangle>(); + public void sortByY() { + List<Rectangle> rectangles = new ArrayList<>(); rectangles.add(new Rectangle(0, 3, 1, 1)); rectangles.add(new Rectangle(0, 5, 1, 1)); rectangles.add(new Rectangle(0, 1, 1, 1)); @@ -785,9 +738,9 @@ public class SelectionModelTest { this.model.sortByY(rectangles); - Assert.assertEquals(1, rectangles.get(0).y); - Assert.assertEquals(3, rectangles.get(1).y); - Assert.assertEquals(5, rectangles.get(2).y); - Assert.assertEquals(13, rectangles.get(3).y); + assertEquals(1, rectangles.get(0).y); + assertEquals(3, rectangles.get(1).y); + assertEquals(5, rectangles.get(2).y); + assertEquals(13, rectangles.get(3).y); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectionUtilsTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectionUtilsTest.java index 231f6fc0..da595176 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectionUtilsTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectionUtilsTest.java @@ -13,11 +13,11 @@ *****************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; @@ -29,7 +29,7 @@ import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixtu import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell; import org.eclipse.nebula.widgets.nattable.test.fixture.data.DataProviderFixture; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class SelectionUtilsTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/action/SelectionDragModeTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/action/SelectionDragModeTest.java index c1d462d6..1b10afd7 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/action/SelectionDragModeTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/action/SelectionDragModeTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection.action; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.util.List; @@ -26,8 +26,8 @@ import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class SelectionDragModeTest { @@ -37,7 +37,7 @@ public class SelectionDragModeTest { private DummyGridLayerStack gridLayer; private LayerListenerFixture listener; - @Before + @BeforeEach public void setup() { this.gridLayer = new DummyGridLayerStack(); this.natTable = new NatTable(new Shell(Display.getDefault()), this.gridLayer); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/event/SelectionEventsTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/event/SelectionEventsTest.java index 37195b82..857a7681 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/event/SelectionEventsTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/event/SelectionEventsTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection.event; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.nebula.widgets.nattable.grid.layer.event.ColumnHeaderSelectionEvent; import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand; @@ -21,8 +21,8 @@ import org.eclipse.nebula.widgets.nattable.selection.command.SelectColumnCommand import org.eclipse.nebula.widgets.nattable.selection.command.SelectRowsCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class SelectionEventsTest { @@ -35,7 +35,7 @@ public class SelectionEventsTest { NatTableFixture natTable; private LayerListenerFixture listener; - @Before + @BeforeEach public void setup() { this.natTable = new NatTableFixture(); this.listener = new LayerListenerFixture(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/preserve/PreserveSelectionModelIntegrationTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/preserve/PreserveSelectionModelIntegrationTest.java index 35d4814f..2bb8b4a2 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/preserve/PreserveSelectionModelIntegrationTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/preserve/PreserveSelectionModelIntegrationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2020 Dirk Fauth. + * Copyright (c) 2018, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection.preserve; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.Serializable; import java.util.List; @@ -42,8 +42,8 @@ import org.eclipse.nebula.widgets.nattable.selection.command.ClearAllSelectionsC import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand; import org.eclipse.nebula.widgets.nattable.selection.command.SelectColumnCommand; import org.eclipse.nebula.widgets.nattable.selection.command.SelectRowsCommand; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class PreserveSelectionModelIntegrationTest { @@ -56,7 +56,7 @@ public class PreserveSelectionModelIntegrationTest { private SelectionLayer selectionLayerWithResizeHideShow; - @Before + @BeforeEach public void setup() { this.dataModel = PersonService.getFixedPersons(); this.dataProvider = new ListDataProvider<>( @@ -94,44 +94,44 @@ public class PreserveSelectionModelIntegrationTest { @Test public void shouldShowFullySelectedColumnOnColumnSelection() { - assertFalse("column 1 is fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertFalse(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is fully selected"); this.selectionLayer.doCommand(new SelectColumnCommand(this.selectionLayer, 1, 0, false, false)); - assertTrue("column 1 is not fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is not fully selected"); } @Test public void shouldNotShowFullySelectedColumnOnClear() { - assertFalse("column 1 is fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertFalse(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is fully selected"); this.selectionLayer.doCommand(new SelectColumnCommand(this.selectionLayer, 1, 0, false, false)); - assertTrue("column 1 is not fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is not fully selected"); this.selectionLayer.doCommand(new ClearAllSelectionsCommand()); - assertFalse("column 1 is fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertFalse(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is fully selected"); } @Test public void shouldNotShowFullySelectedColumnOnDeselectCell() { - assertFalse("column 1 is fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertFalse(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is fully selected"); this.selectionLayer.doCommand(new SelectColumnCommand(this.selectionLayer, 1, 0, false, false)); - assertTrue("column 1 is not fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); - assertTrue("cell 1/3 is not selected", this.selectionLayer.isCellPositionSelected(1, 3)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is not fully selected"); + assertTrue(this.selectionLayer.isCellPositionSelected(1, 3), "cell 1/3 is not selected"); // deselect a cell that was selected before this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 1, 3, false, true)); - assertFalse("cell 1/3 is selected", this.selectionLayer.isCellPositionSelected(1, 3)); - assertFalse("column 1 is fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertFalse(this.selectionLayer.isCellPositionSelected(1, 3), "cell 1/3 is selected"); + assertFalse(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is fully selected"); } @Test public void shouldShowFullySelectedColumnOnColumnSelectionBeforeHideRow() { - assertFalse("column 1 is fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertFalse(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is fully selected"); this.selectionLayer.doCommand(new SelectColumnCommand(this.selectionLayer, 1, 0, false, false)); - assertTrue("column 1 is not fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is not fully selected"); // hide a row assertEquals(18, this.selectionLayer.getRowCount()); this.selectionLayer.doCommand(new RowHideCommand(this.selectionLayer, 5)); assertEquals(17, this.selectionLayer.getRowCount()); - assertTrue("column 1 is not fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is not fully selected"); } @Test @@ -141,49 +141,49 @@ public class PreserveSelectionModelIntegrationTest { this.selectionLayer.doCommand(new RowHideCommand(this.selectionLayer, 5)); assertEquals(17, this.selectionLayer.getRowCount()); - assertFalse("column 1 is fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertFalse(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is fully selected"); this.selectionLayer.doCommand(new SelectColumnCommand(this.selectionLayer, 1, 0, false, false)); - assertTrue("column 1 is not fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is not fully selected"); } @Test public void shouldNotShowFullySelectedColumnOnColumnSelectionBeforeHideRowOnDeselect() { - assertFalse("column 1 is fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertFalse(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is fully selected"); this.selectionLayer.doCommand(new SelectColumnCommand(this.selectionLayer, 1, 0, false, false)); - assertTrue("column 1 is not fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is not fully selected"); // hide a row assertEquals(18, this.selectionLayer.getRowCount()); this.selectionLayer.doCommand(new RowHideCommand(this.selectionLayer, 5)); assertEquals(17, this.selectionLayer.getRowCount()); - assertTrue("column 1 is not fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is not fully selected"); - assertTrue("cell 1/3 is not selected", this.selectionLayer.isCellPositionSelected(1, 3)); + assertTrue(this.selectionLayer.isCellPositionSelected(1, 3), "cell 1/3 is not selected"); // deselect a cell that was selected before this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 1, 3, false, true)); - assertFalse("cell 1/3 is selected", this.selectionLayer.isCellPositionSelected(1, 3)); - assertFalse("column 1 is fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertFalse(this.selectionLayer.isCellPositionSelected(1, 3), "cell 1/3 is selected"); + assertFalse(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is fully selected"); } @Test public void shouldNotShowFullySelectedColumnOnColumnSelectionAfterHideAndShowAll() { - assertFalse("column 1 is fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertFalse(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is fully selected"); this.selectionLayer.doCommand(new SelectColumnCommand(this.selectionLayer, 1, 0, false, false)); - assertTrue("column 1 is not fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is not fully selected"); // hide a row assertEquals(18, this.selectionLayer.getRowCount()); this.selectionLayer.doCommand(new RowHideCommand(this.selectionLayer, 5)); assertEquals(17, this.selectionLayer.getRowCount()); - assertTrue("column 1 is not fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is not fully selected"); // show all again this.selectionLayer.doCommand(new ShowAllRowsCommand()); assertEquals(18, this.selectionLayer.getRowCount()); - assertFalse("column 1 is fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertFalse(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is fully selected"); } @Test @@ -193,57 +193,57 @@ public class PreserveSelectionModelIntegrationTest { this.selectionLayer.doCommand(new RowHideCommand(this.selectionLayer, 5)); assertEquals(17, this.selectionLayer.getRowCount()); - assertFalse("column 1 is fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertFalse(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is fully selected"); this.selectionLayer.doCommand(new SelectColumnCommand(this.selectionLayer, 1, 0, false, false)); - assertTrue("column 1 is not fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is not fully selected"); - assertTrue("cell 1/3 is not selected", this.selectionLayer.isCellPositionSelected(1, 3)); + assertTrue(this.selectionLayer.isCellPositionSelected(1, 3), "cell 1/3 is not selected"); // deselect a cell that was selected before this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 1, 3, false, true)); - assertFalse("cell 1/3 is selected", this.selectionLayer.isCellPositionSelected(1, 3)); - assertFalse("column 1 is fully selected", this.selectionLayer.isColumnPositionFullySelected(1)); + assertFalse(this.selectionLayer.isCellPositionSelected(1, 3), "cell 1/3 is selected"); + assertFalse(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is fully selected"); } @Test public void shouldShowFullySelectedRowOnRowSelection() { - assertFalse("row 1 is fully selected", this.selectionLayer.isRowPositionFullySelected(1)); + assertFalse(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is fully selected"); this.selectionLayer.doCommand(new SelectRowsCommand(this.selectionLayer, 0, 1, false, false)); - assertTrue("row 1 is not fully selected", this.selectionLayer.isRowPositionFullySelected(1)); + assertTrue(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is not fully selected"); } @Test public void shouldNotShowFullySelectedRowOnClear() { - assertFalse("row 1 is fully selected", this.selectionLayer.isRowPositionFullySelected(1)); + assertFalse(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is fully selected"); this.selectionLayer.doCommand(new SelectRowsCommand(this.selectionLayer, 0, 1, false, false)); - assertTrue("row 1 is not fully selected", this.selectionLayer.isRowPositionFullySelected(1)); + assertTrue(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is not fully selected"); this.selectionLayer.doCommand(new ClearAllSelectionsCommand()); - assertFalse("row 1 is fully selected", this.selectionLayer.isRowPositionFullySelected(1)); + assertFalse(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is fully selected"); } @Test public void shouldNotShowFullySelectedRowOnDeselectCell() { - assertFalse("row 1 is fully selected", this.selectionLayer.isRowPositionFullySelected(1)); + assertFalse(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is fully selected"); this.selectionLayer.doCommand(new SelectRowsCommand(this.selectionLayer, 0, 1, false, false)); - assertTrue("row 1 is not fully selected", this.selectionLayer.isRowPositionFullySelected(1)); - assertTrue("cell 3/1 is not selected", this.selectionLayer.isCellPositionSelected(3, 1)); + assertTrue(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is not fully selected"); + assertTrue(this.selectionLayer.isCellPositionSelected(3, 1), "cell 3/1 is not selected"); // deselect a cell that was selected before this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 3, 1, false, true)); - assertFalse("cell 3/1 is selected", this.selectionLayer.isCellPositionSelected(3, 1)); - assertFalse("row 1 is fully selected", this.selectionLayer.isRowPositionFullySelected(1)); + assertFalse(this.selectionLayer.isCellPositionSelected(3, 1), "cell 3/1 is selected"); + assertFalse(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is fully selected"); } @Test public void shouldShowFullySelectedRowOnRowSelectionBeforeHideColumn() { - assertFalse("row 1 is fully selected", this.selectionLayer.isRowPositionFullySelected(1)); + assertFalse(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is fully selected"); this.selectionLayer.doCommand(new SelectRowsCommand(this.selectionLayer, 0, 1, false, false)); - assertTrue("row 1 is not fully selected", this.selectionLayer.isRowPositionFullySelected(1)); + assertTrue(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is not fully selected"); // hide a column assertEquals(5, this.selectionLayer.getColumnCount()); this.selectionLayer.doCommand(new ColumnHideCommand(this.selectionLayer, 3)); assertEquals(4, this.selectionLayer.getColumnCount()); - assertTrue("row 1 is not fully selected", this.selectionLayer.isRowPositionFullySelected(1)); + assertTrue(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is not fully selected"); } @Test @@ -253,29 +253,29 @@ public class PreserveSelectionModelIntegrationTest { this.selectionLayer.doCommand(new ColumnHideCommand(this.selectionLayer, 3)); assertEquals(4, this.selectionLayer.getColumnCount()); - assertFalse("row 1 is fully selected", this.selectionLayer.isRowPositionFullySelected(1)); + assertFalse(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is fully selected"); this.selectionLayer.doCommand(new SelectRowsCommand(this.selectionLayer, 0, 1, false, false)); - assertTrue("row 1 is not fully selected", this.selectionLayer.isRowPositionFullySelected(1)); + assertTrue(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is not fully selected"); } @Test public void shouldNotShowFullySelectedRowOnRowSelectionBeforeHideColumnOnDeselect() { - assertFalse("row 1 is fully selected", this.selectionLayer.isRowPositionFullySelected(1)); + assertFalse(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is fully selected"); this.selectionLayer.doCommand(new SelectRowsCommand(this.selectionLayer, 0, 1, false, false)); - assertTrue("row 1 is not fully selected", this.selectionLayer.isRowPositionFullySelected(1)); + assertTrue(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is not fully selected"); // hide a column assertEquals(5, this.selectionLayer.getColumnCount()); this.selectionLayer.doCommand(new ColumnHideCommand(this.selectionLayer, 3)); assertEquals(4, this.selectionLayer.getColumnCount()); - assertTrue("row 1 is not fully selected", this.selectionLayer.isRowPositionFullySelected(1)); + assertTrue(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is not fully selected"); - assertTrue("cell 3/1 is not selected", this.selectionLayer.isCellPositionSelected(3, 1)); + assertTrue(this.selectionLayer.isCellPositionSelected(3, 1), "cell 3/1 is not selected"); // deselect a cell that was selected before this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 3, 1, false, true)); - assertFalse("cell 3/1 is selected", this.selectionLayer.isCellPositionSelected(3, 1)); - assertFalse("row 1 is fully selected", this.selectionLayer.isRowPositionFullySelected(1)); + assertFalse(this.selectionLayer.isCellPositionSelected(3, 1), "cell 3/1 is selected"); + assertFalse(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is fully selected"); } @Test @@ -285,29 +285,29 @@ public class PreserveSelectionModelIntegrationTest { this.selectionLayer.doCommand(new ColumnHideCommand(this.selectionLayer, 3)); assertEquals(4, this.selectionLayer.getColumnCount()); - assertFalse("row 1 is fully selected", this.selectionLayer.isRowPositionFullySelected(1)); + assertFalse(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is fully selected"); this.selectionLayer.doCommand(new SelectRowsCommand(this.selectionLayer, 0, 1, false, false)); - assertTrue("row 1 is not fully selected", this.selectionLayer.isRowPositionFullySelected(1)); + assertTrue(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is not fully selected"); - assertTrue("cell 3/1 is not selected", this.selectionLayer.isCellPositionSelected(3, 1)); + assertTrue(this.selectionLayer.isCellPositionSelected(3, 1), "cell 3/1 is not selected"); // deselect a cell that was selected before this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 3, 1, false, true)); - assertFalse("cell 3/1 is selected", this.selectionLayer.isCellPositionSelected(3, 1)); - assertFalse("row 1 is fully selected", this.selectionLayer.isRowPositionFullySelected(1)); + assertFalse(this.selectionLayer.isCellPositionSelected(3, 1), "cell 3/1 is selected"); + assertFalse(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is fully selected"); } @Test public void shouldShowFullySelectedRowOnRowSelectionBeforeHideColumnResize() { - assertFalse("row 1 is fully selected", this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1)); + assertFalse(this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1), "row 1 is fully selected"); this.selectionLayerWithResizeHideShow.doCommand(new SelectRowsCommand(this.selectionLayerWithResizeHideShow, 0, 1, false, false)); - assertTrue("row 1 is not fully selected", this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1)); + assertTrue(this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1), "row 1 is not fully selected"); // hide a column assertEquals(5, this.selectionLayerWithResizeHideShow.getColumnCount()); this.selectionLayerWithResizeHideShow.doCommand(new ColumnHideCommand(this.selectionLayerWithResizeHideShow, 3)); assertEquals(5, this.selectionLayerWithResizeHideShow.getColumnCount()); - assertTrue("row 1 is not fully selected", this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1)); + assertTrue(this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1), "row 1 is not fully selected"); } @Test @@ -317,29 +317,29 @@ public class PreserveSelectionModelIntegrationTest { this.selectionLayerWithResizeHideShow.doCommand(new ColumnHideCommand(this.selectionLayerWithResizeHideShow, 3)); assertEquals(5, this.selectionLayerWithResizeHideShow.getColumnCount()); - assertFalse("row 1 is fully selected", this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1)); + assertFalse(this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1), "row 1 is fully selected"); this.selectionLayerWithResizeHideShow.doCommand(new SelectRowsCommand(this.selectionLayerWithResizeHideShow, 0, 1, false, false)); - assertTrue("row 1 is not fully selected", this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1)); + assertTrue(this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1), "row 1 is not fully selected"); } @Test public void shouldNotShowFullySelectedRowOnRowSelectionBeforeHideColumnOnDeselectResize() { - assertFalse("row 1 is fully selected", this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1)); + assertFalse(this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1), "row 1 is fully selected"); this.selectionLayerWithResizeHideShow.doCommand(new SelectRowsCommand(this.selectionLayerWithResizeHideShow, 0, 1, false, false)); - assertTrue("row 1 is not fully selected", this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1)); + assertTrue(this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1), "row 1 is not fully selected"); // hide a column assertEquals(5, this.selectionLayerWithResizeHideShow.getColumnCount()); this.selectionLayerWithResizeHideShow.doCommand(new ColumnHideCommand(this.selectionLayerWithResizeHideShow, 3)); assertEquals(5, this.selectionLayerWithResizeHideShow.getColumnCount()); - assertTrue("row 1 is not fully selected", this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1)); + assertTrue(this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1), "row 1 is not fully selected"); - assertTrue("cell 3/1 is not selected", this.selectionLayerWithResizeHideShow.isCellPositionSelected(3, 1)); + assertTrue(this.selectionLayerWithResizeHideShow.isCellPositionSelected(3, 1), "cell 3/1 is not selected"); // deselect a cell that was selected before this.selectionLayerWithResizeHideShow.doCommand(new SelectCellCommand(this.selectionLayerWithResizeHideShow, 3, 1, false, true)); - assertFalse("cell 3/1 is selected", this.selectionLayerWithResizeHideShow.isCellPositionSelected(3, 1)); - assertFalse("row 1 is fully selected", this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1)); + assertFalse(this.selectionLayerWithResizeHideShow.isCellPositionSelected(3, 1), "cell 3/1 is selected"); + assertFalse(this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1), "row 1 is fully selected"); } @Test @@ -349,26 +349,26 @@ public class PreserveSelectionModelIntegrationTest { this.selectionLayerWithResizeHideShow.doCommand(new ColumnHideCommand(this.selectionLayerWithResizeHideShow, 3)); assertEquals(5, this.selectionLayerWithResizeHideShow.getColumnCount()); - assertFalse("row 1 is fully selected", this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1)); + assertFalse(this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1), "row 1 is fully selected"); this.selectionLayerWithResizeHideShow.doCommand(new SelectRowsCommand(this.selectionLayerWithResizeHideShow, 0, 1, false, false)); - assertTrue("row 1 is not fully selected", this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1)); + assertTrue(this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1), "row 1 is not fully selected"); - assertTrue("cell 3/1 is not selected", this.selectionLayerWithResizeHideShow.isCellPositionSelected(3, 1)); + assertTrue(this.selectionLayerWithResizeHideShow.isCellPositionSelected(3, 1), "cell 3/1 is not selected"); // deselect a cell that was selected before this.selectionLayerWithResizeHideShow.doCommand(new SelectCellCommand(this.selectionLayerWithResizeHideShow, 3, 1, false, true)); - assertFalse("cell 3/1 is selected", this.selectionLayerWithResizeHideShow.isCellPositionSelected(3, 1)); - assertFalse("row 1 is fully selected", this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1)); + assertFalse(this.selectionLayerWithResizeHideShow.isCellPositionSelected(3, 1), "cell 3/1 is selected"); + assertFalse(this.selectionLayerWithResizeHideShow.isRowPositionFullySelected(1), "row 1 is fully selected"); } @Test public void shouldShowFullySelectedRowOnReorder() { - assertFalse("row 1 is fully selected", this.selectionLayer.isRowPositionFullySelected(1)); + assertFalse(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is fully selected"); this.selectionLayer.doCommand(new SelectRowsCommand(this.selectionLayer, 0, 1, false, false)); - assertTrue("row 1 is not fully selected", this.selectionLayer.isRowPositionFullySelected(1)); + assertTrue(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is not fully selected"); this.selectionLayer.doCommand(new ColumnReorderCommand(this.selectionLayer, 4, 0)); - assertTrue("row 1 is not fully selected", this.selectionLayer.isRowPositionFullySelected(1)); + assertTrue(this.selectionLayer.isRowPositionFullySelected(1), "row 1 is not fully selected"); } @Test @@ -376,8 +376,8 @@ public class PreserveSelectionModelIntegrationTest { this.selectionLayer.doCommand(new SelectColumnCommand(this.selectionLayer, 2, 0, false, false)); this.selectionLayer.doCommand(new SelectColumnCommand(this.selectionLayer, 3, 0, false, true)); - assertTrue("column 2 is not selected", this.selectionLayer.isColumnPositionFullySelected(2)); - assertTrue("column 3 is not selected", this.selectionLayer.isColumnPositionFullySelected(3)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(2), "column 2 is not selected"); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(3), "column 3 is not selected"); this.columnHideShowLayer.doCommand(new MultiColumnHideCommand(this.selectionLayer, 2, 3)); @@ -393,9 +393,9 @@ public class PreserveSelectionModelIntegrationTest { this.selectionLayer.doCommand(new SelectColumnCommand(this.selectionLayer, 3, 0, false, true)); this.selectionLayer.doCommand(new SelectColumnCommand(this.selectionLayer, 4, 0, false, true)); - assertTrue("column 2 is not selected", this.selectionLayer.isColumnPositionFullySelected(2)); - assertTrue("column 3 is not selected", this.selectionLayer.isColumnPositionFullySelected(3)); - assertTrue("column 4 is not selected", this.selectionLayer.isColumnPositionFullySelected(4)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(2), "column 2 is not selected"); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(3), "column 3 is not selected"); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(4), "column 4 is not selected"); this.columnHideShowLayer.doCommand(new MultiColumnHideCommand(this.selectionLayer, 2, 3)); @@ -411,9 +411,9 @@ public class PreserveSelectionModelIntegrationTest { this.selectionLayer.doCommand(new SelectColumnCommand(this.selectionLayer, 3, 0, false, true)); this.selectionLayer.doCommand(new SelectColumnCommand(this.selectionLayer, 4, 0, false, true)); - assertTrue("column 1 is not selected", this.selectionLayer.isColumnPositionFullySelected(1)); - assertTrue("column 3 is not selected", this.selectionLayer.isColumnPositionFullySelected(3)); - assertTrue("column 4 is not selected", this.selectionLayer.isColumnPositionFullySelected(4)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(1), "column 1 is not selected"); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(3), "column 3 is not selected"); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(4), "column 4 is not selected"); this.columnHideShowLayer.doCommand(new MultiColumnHideCommand(this.selectionLayer, 1, 3)); @@ -427,14 +427,14 @@ public class PreserveSelectionModelIntegrationTest { public void shouldUpdateConsecutiveColumnSelectionOnShowColumns() { this.selectionLayer.doCommand(new SelectColumnCommand(this.selectionLayer, 4, 0, false, true)); - assertTrue("column 4 is not selected", this.selectionLayer.isColumnPositionFullySelected(4)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(4), "column 4 is not selected"); this.columnHideShowLayer.doCommand(new MultiColumnHideCommand(this.selectionLayer, 2, 3)); assertEquals(3, this.selectionLayer.getColumnCount()); assertEquals(1, this.selectionLayer.getFullySelectedColumnPositions().length); assertEquals(1, this.selectionLayer.getSelectedColumnPositions().length); - assertTrue("column 2 is not selected", this.selectionLayer.isColumnPositionFullySelected(2)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(2), "column 2 is not selected"); assertEquals(18, this.selectionLayer.getSelectedRowPositions().size()); this.columnHideShowLayer.doCommand(new ShowAllColumnsCommand()); @@ -442,7 +442,7 @@ public class PreserveSelectionModelIntegrationTest { assertEquals(5, this.selectionLayer.getColumnCount()); assertEquals(1, this.selectionLayer.getFullySelectedColumnPositions().length); assertEquals(1, this.selectionLayer.getSelectedColumnPositions().length); - assertTrue("column 4 is not selected", this.selectionLayer.isColumnPositionFullySelected(4)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(4), "column 4 is not selected"); assertEquals(18, this.selectionLayer.getSelectedRowPositions().size()); } @@ -450,14 +450,14 @@ public class PreserveSelectionModelIntegrationTest { public void shouldUpdateColumnSelectionOnShowColumns() { this.selectionLayer.doCommand(new SelectColumnCommand(this.selectionLayer, 4, 0, false, true)); - assertTrue("column 4 is not selected", this.selectionLayer.isColumnPositionFullySelected(4)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(4), "column 4 is not selected"); this.columnHideShowLayer.doCommand(new MultiColumnHideCommand(this.selectionLayer, 1, 3)); assertEquals(3, this.selectionLayer.getColumnCount()); assertEquals(1, this.selectionLayer.getFullySelectedColumnPositions().length); assertEquals(1, this.selectionLayer.getSelectedColumnPositions().length); - assertTrue("column 2 is not selected", this.selectionLayer.isColumnPositionFullySelected(2)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(2), "column 2 is not selected"); assertEquals(18, this.selectionLayer.getSelectedRowPositions().size()); this.columnHideShowLayer.doCommand(new ShowAllColumnsCommand()); @@ -465,7 +465,7 @@ public class PreserveSelectionModelIntegrationTest { assertEquals(5, this.selectionLayer.getColumnCount()); assertEquals(1, this.selectionLayer.getFullySelectedColumnPositions().length); assertEquals(1, this.selectionLayer.getSelectedColumnPositions().length); - assertTrue("column 4 is not selected", this.selectionLayer.isColumnPositionFullySelected(4)); + assertTrue(this.selectionLayer.isColumnPositionFullySelected(4), "column 4 is not selected"); assertEquals(18, this.selectionLayer.getSelectedRowPositions().size()); } @@ -474,8 +474,8 @@ public class PreserveSelectionModelIntegrationTest { this.selectionLayer.doCommand(new SelectRowsCommand(this.selectionLayer, 0, 2, false, false)); this.selectionLayer.doCommand(new SelectRowsCommand(this.selectionLayer, 0, 3, false, true)); - assertTrue("row 2 is not selected", this.selectionLayer.isRowPositionFullySelected(2)); - assertTrue("row 3 is not selected", this.selectionLayer.isRowPositionFullySelected(3)); + assertTrue(this.selectionLayer.isRowPositionFullySelected(2), "row 2 is not selected"); + assertTrue(this.selectionLayer.isRowPositionFullySelected(3), "row 3 is not selected"); this.rowHideShowLayer.doCommand(new MultiRowHideCommand(this.selectionLayer, 2, 3)); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/preserve/PreserveSelectionModelTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/preserve/PreserveSelectionModelTest.java index d5fa6bed..c2f485e9 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/preserve/PreserveSelectionModelTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/preserve/PreserveSelectionModelTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2020 Jonas Hugo, Markus Wahl, Dirk Fauth. + * Copyright (c) 2014, 2022 Jonas Hugo, Markus Wahl, Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -13,11 +13,11 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection.preserve; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.Serializable; import java.util.Arrays; @@ -34,8 +34,8 @@ import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; import org.eclipse.nebula.widgets.nattable.selection.preserve.Selections.CellPosition; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class PreserveSelectionModelTest { @@ -57,7 +57,7 @@ public class PreserveSelectionModelTest { private TestCell[][] cells = new TestCell[7][3]; - @Before + @BeforeEach public void setUp() throws Exception { this.rowDataProvider = new TestRowDataProvider(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/preserve/SelectionsTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/preserve/SelectionsTest.java index da88777b..ef554f56 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/preserve/SelectionsTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/preserve/SelectionsTest.java @@ -14,16 +14,16 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.selection.preserve; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.Serializable; import java.util.Arrays; import java.util.HashSet; import org.eclipse.nebula.widgets.nattable.selection.preserve.Selections.CellPosition; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class SelectionsTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/sort/SortDirectionEnumTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/sort/SortDirectionEnumTest.java index 62f002a9..a8e5ef4b 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/sort/SortDirectionEnumTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/sort/SortDirectionEnumTest.java @@ -15,9 +15,9 @@ package org.eclipse.nebula.widgets.nattable.sort; import static org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum.ASC; import static org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum.DESC; import static org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum.NONE; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class SortDirectionEnumTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/CellSelectionTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/CellSelectionTest.java index e3901391..26930e7e 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/CellSelectionTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/CellSelectionTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,20 +12,20 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.style; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.layer.ILayer; import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell; import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.InitializeClientAreaCommandFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class CellSelectionTest { private GridLayerFixture gridLayer; - @Before + @BeforeEach public void setUp() { this.gridLayer = new GridLayerFixture(); this.gridLayer.doCommand(new InitializeClientAreaCommandFixture()); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/CellStyleProxyTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/CellStyleProxyTest.java index 207f21f0..14d7e6e9 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/CellStyleProxyTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/CellStyleProxyTest.java @@ -12,13 +12,13 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.style; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.Arrays; import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes; import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class CellStyleProxyTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/ColumnHeaderLayerSelectionTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/ColumnHeaderLayerSelectionTest.java index b4670bf5..59ac9e6f 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/ColumnHeaderLayerSelectionTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/ColumnHeaderLayerSelectionTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.style; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Collection; import java.util.HashSet; @@ -29,14 +29,14 @@ import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.InitializeClientAreaCommandFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture; import org.eclipse.nebula.widgets.nattable.viewport.command.ViewportSelectColumnCommand; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnHeaderLayerSelectionTest { private GridLayerFixture gridLayer; - @Before + @BeforeEach public void setUp() { this.gridLayer = new GridLayerFixture(); this.gridLayer.doCommand(new InitializeClientAreaCommandFixture()); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/DefaultDisplayModeOrderingTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/DefaultDisplayModeOrderingTest.java index 48ce1e0e..3a6bcf3b 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/DefaultDisplayModeOrderingTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/DefaultDisplayModeOrderingTest.java @@ -12,11 +12,11 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.style; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DefaultDisplayModeOrderingTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/RowHeaderSelectionTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/RowHeaderSelectionTest.java index 956262ba..f397f6a3 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/RowHeaderSelectionTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/RowHeaderSelectionTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.style; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer; import org.eclipse.nebula.widgets.nattable.layer.LabelStack; @@ -23,14 +23,14 @@ import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.InitializeClientAreaCommandFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture; import org.eclipse.nebula.widgets.nattable.viewport.command.ViewportSelectRowCommand; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowHeaderSelectionTest { private GridLayerFixture gridLayer; - @Before + @BeforeEach public void setUp() { this.gridLayer = new GridLayerFixture(); this.gridLayer.doCommand(new InitializeClientAreaCommandFixture()); @@ -67,6 +67,6 @@ public class RowHeaderSelectionTest { rowPosition = this.gridLayer.localToUnderlyingRowPosition(4); labelStack = rowHeaderLayer.getConfigLabelsByPosition(0, rowPosition); - assertFalse("Should not have returned fully selected style.", labelStack.hasLabel(SelectionStyleLabels.ROW_FULLY_SELECTED_STYLE)); + assertFalse(labelStack.hasLabel(SelectionStyleLabels.ROW_FULLY_SELECTED_STYLE), "Should not have returned fully selected style."); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/StyleInheritanceTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/StyleInheritanceTest.java index a5bb0ecb..60b40037 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/StyleInheritanceTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/StyleInheritanceTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.style; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes; @@ -26,8 +26,8 @@ import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.widgets.Display; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class StyleInheritanceTest { @@ -41,7 +41,7 @@ public class StyleInheritanceTest { private Color defaultBackgroundColor; private final Font font = GUIHelper.getFont(FONT_DATA); - @Before + @BeforeEach public void setUp() throws Exception { this.natTable = new NatTableFixture(); this.superCellStyle = new Style(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/editor/command/DisplayColumnStyleEditorCommandHandlerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/editor/command/DisplayColumnStyleEditorCommandHandlerTest.java index 9c531b8d..60067a0f 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/editor/command/DisplayColumnStyleEditorCommandHandlerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/style/editor/command/DisplayColumnStyleEditorCommandHandlerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -15,7 +15,7 @@ package org.eclipse.nebula.widgets.nattable.style.editor.command; import static org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes.CELL_STYLE; import static org.eclipse.nebula.widgets.nattable.style.DisplayMode.NORMAL; import static org.eclipse.nebula.widgets.nattable.style.editor.command.DisplayColumnStyleEditorCommandHandler.USER_EDITED_COLUMN_STYLE_LABEL_PREFIX; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.List; import java.util.Properties; @@ -37,8 +37,8 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.PropertiesFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class DisplayColumnStyleEditorCommandHandlerTest { @@ -48,7 +48,7 @@ public class DisplayColumnStyleEditorCommandHandlerTest { private DisplayColumnStyleEditorCommandHandler handlerUnderTest; private IConfigRegistry configRegistryFixture; - @Before + @BeforeEach public void setup() { this.labelAccumulatorFixture = new ColumnOverrideLabelAccumulator( new DataLayerFixture()); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/summaryrow/SummaryRowIntegrationTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/summaryrow/SummaryRowIntegrationTest.java index b7ea1124..e4bbbfaf 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/summaryrow/SummaryRowIntegrationTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/summaryrow/SummaryRowIntegrationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.summaryrow; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Collection; import java.util.Date; @@ -49,8 +49,8 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class SummaryRowIntegrationTest { @@ -67,7 +67,7 @@ public class SummaryRowIntegrationTest { private DataLayer dataLayer; private ListDataProvider<RowDataFixture> dataProvider; - @Before + @BeforeEach public void initLayerStackWithSummaryRow() { this.dataList = RowDataListFixture.getList().subList(0, 4); // Rows 0, 1, 2, 3; Summary row would be position 4 @@ -341,7 +341,7 @@ public class SummaryRowIntegrationTest { configLabels = this.natTable.getConfigLabelsByPosition(0, 3); assertEquals(1, configLabels.size()); - assertTrue("Label in default body does not start with myLabel", configLabels.get(0).startsWith("myLabel")); + assertTrue(configLabels.get(0).startsWith("myLabel"), "Label in default body does not start with myLabel"); } @Test diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/LayerAssert.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/LayerAssert.java index 22a767a7..a613d72c 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/LayerAssert.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/LayerAssert.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.test; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.layer.ILayer; import org.eclipse.nebula.widgets.nattable.layer.LabelStack; @@ -29,32 +29,22 @@ public class LayerAssert { int expectedColumnCount = expectedLayer.getColumnCount(); int actualColumnCount = actualLayer.getColumnCount(); - assertEquals("Column count", expectedColumnCount, - actualColumnCount); + assertEquals(expectedColumnCount, actualColumnCount); // Assert.assertEquals("Preferred column count", // expectedLayer.getPreferredColumnCount(), // actualLayer.getPreferredColumnCount()); for (int columnPosition = 0; columnPosition < expectedColumnCount; columnPosition++) { - int expectedColumnIndexByPosition = expectedLayer - .getColumnIndexByPosition(columnPosition); - int actualColumnIndexByPosition = actualLayer - .getColumnIndexByPosition(columnPosition); - assertEquals("Column index by position (" + columnPosition - + ")", expectedColumnIndexByPosition, - actualColumnIndexByPosition); + int expectedColumnIndexByPosition = expectedLayer.getColumnIndexByPosition(columnPosition); + int actualColumnIndexByPosition = actualLayer.getColumnIndexByPosition(columnPosition); + assertEquals(expectedColumnIndexByPosition, actualColumnIndexByPosition); } for (int localColumnPosition = 0; localColumnPosition < expectedColumnCount; localColumnPosition++) { - int expectedLocalToUnderlyingColumnPosition = expectedLayer - .localToUnderlyingColumnPosition(localColumnPosition); - int actualLocalToUnderlyingColumnPosition = actualLayer - .localToUnderlyingColumnPosition(localColumnPosition); - assertEquals("Local to underlying column position (" - + localColumnPosition + ")", - expectedLocalToUnderlyingColumnPosition, - actualLocalToUnderlyingColumnPosition); + int expectedLocalToUnderlyingColumnPosition = expectedLayer.localToUnderlyingColumnPosition(localColumnPosition); + int actualLocalToUnderlyingColumnPosition = actualLayer.localToUnderlyingColumnPosition(localColumnPosition); + assertEquals(expectedLocalToUnderlyingColumnPosition, actualLocalToUnderlyingColumnPosition); } // for (int underlyingColumnPosition = 0; underlyingColumnPosition < @@ -71,51 +61,37 @@ public class LayerAssert { int expectedWidth = expectedLayer.getWidth(); int actualWidth = actualLayer.getWidth(); - assertEquals("Width", expectedWidth, actualWidth); + assertEquals(expectedWidth, actualWidth); // Assert.assertEquals("Preferred width", // expectedLayer.getPreferredWidth(), actualLayer.getPreferredWidth()); for (int columnPosition = 0; columnPosition < expectedColumnCount; columnPosition++) { - int expectedColumnWidthByPosition = expectedLayer - .getColumnWidthByPosition(columnPosition); - int actualColumnWidthByPosition = actualLayer - .getColumnWidthByPosition(columnPosition); - assertEquals("Column width by position (" + columnPosition - + ")", expectedColumnWidthByPosition, - actualColumnWidthByPosition); + int expectedColumnWidthByPosition = expectedLayer.getColumnWidthByPosition(columnPosition); + int actualColumnWidthByPosition = actualLayer.getColumnWidthByPosition(columnPosition); + assertEquals(expectedColumnWidthByPosition, actualColumnWidthByPosition); } // Column resize for (int columnPosition = 0; columnPosition < expectedColumnCount; columnPosition++) { - boolean expectedColumnPositionResizable = expectedLayer - .isColumnPositionResizable(columnPosition); - boolean actualColumnPositionResizable = actualLayer - .isColumnPositionResizable(columnPosition); - assertEquals("Column position resizable (" + columnPosition - + ")", expectedColumnPositionResizable, - actualColumnPositionResizable); + boolean expectedColumnPositionResizable = expectedLayer.isColumnPositionResizable(columnPosition); + boolean actualColumnPositionResizable = actualLayer.isColumnPositionResizable(columnPosition); + assertEquals(expectedColumnPositionResizable, actualColumnPositionResizable); } // X for (int x = 0; x < expectedWidth; x++) { - int expectedColumnPositionByX = expectedLayer - .getColumnPositionByX(x); + int expectedColumnPositionByX = expectedLayer.getColumnPositionByX(x); int actualColumnPositionByX = actualLayer.getColumnPositionByX(x); - assertEquals("Column position by X (" + x + ")", - expectedColumnPositionByX, actualColumnPositionByX); + assertEquals(expectedColumnPositionByX, actualColumnPositionByX); } for (int columnPosition = 0; columnPosition < expectedColumnCount; columnPosition++) { - int expectedStartXOfColumnPosition = expectedLayer - .getStartXOfColumnPosition(columnPosition); - int actualStartXOfColumnPosition = actualLayer - .getStartXOfColumnPosition(columnPosition); - assertEquals("Start X of column position (" + columnPosition - + ")", expectedStartXOfColumnPosition, - actualStartXOfColumnPosition); + int expectedStartXOfColumnPosition = expectedLayer.getStartXOfColumnPosition(columnPosition); + int actualStartXOfColumnPosition = actualLayer.getStartXOfColumnPosition(columnPosition); + assertEquals(expectedStartXOfColumnPosition, actualStartXOfColumnPosition); } // Vertical features @@ -124,30 +100,22 @@ public class LayerAssert { int expectedRowCount = expectedLayer.getRowCount(); int actualRowCount = actualLayer.getRowCount(); - assertEquals("Row count", expectedRowCount, actualRowCount); + assertEquals(expectedRowCount, actualRowCount); // Assert.assertEquals("Preferred row count", // expectedLayer.getPreferredRowCount(), // actualLayer.getPreferredRowCount()); for (int rowPosition = 0; rowPosition < expectedRowCount; rowPosition++) { - int expectedRowIndexByPosition = expectedLayer - .getRowIndexByPosition(rowPosition); - int actualRowIndexByPosition = actualLayer - .getRowIndexByPosition(rowPosition); - assertEquals("Row index by position (" + rowPosition + ")", - expectedRowIndexByPosition, actualRowIndexByPosition); + int expectedRowIndexByPosition = expectedLayer.getRowIndexByPosition(rowPosition); + int actualRowIndexByPosition = actualLayer.getRowIndexByPosition(rowPosition); + assertEquals(expectedRowIndexByPosition, actualRowIndexByPosition); } for (int localRowPosition = 0; localRowPosition < expectedRowCount; localRowPosition++) { - int expectedLocalToUnderlyingRowPosition = expectedLayer - .localToUnderlyingRowPosition(localRowPosition); - int actualLocalToUnderlyingRowPosition = actualLayer - .localToUnderlyingRowPosition(localRowPosition); - assertEquals("Local to underlying row position (" - + localRowPosition + ")", - expectedLocalToUnderlyingRowPosition, - actualLocalToUnderlyingRowPosition); + int expectedLocalToUnderlyingRowPosition = expectedLayer.localToUnderlyingRowPosition(localRowPosition); + int actualLocalToUnderlyingRowPosition = actualLayer.localToUnderlyingRowPosition(localRowPosition); + assertEquals(expectedLocalToUnderlyingRowPosition, actualLocalToUnderlyingRowPosition); } // for (int underlyingRowPosition = 0; underlyingRowPosition < @@ -164,30 +132,24 @@ public class LayerAssert { int expectedHeight = expectedLayer.getHeight(); int actualHeight = actualLayer.getHeight(); - assertEquals("Height", expectedHeight, actualHeight); + assertEquals(expectedHeight, actualHeight); // Assert.assertEquals("Preferred height", // expectedLayer.getPreferredHeight(), // actualLayer.getPreferredHeight()); for (int rowPosition = 0; rowPosition < expectedRowCount; rowPosition++) { - int expectedRowHeightByPosition = expectedLayer - .getRowHeightByPosition(rowPosition); - int actualRowHeightByPosition = actualLayer - .getRowHeightByPosition(rowPosition); - assertEquals("Row height by position (" + rowPosition + ")", - expectedRowHeightByPosition, actualRowHeightByPosition); + int expectedRowHeightByPosition = expectedLayer.getRowHeightByPosition(rowPosition); + int actualRowHeightByPosition = actualLayer.getRowHeightByPosition(rowPosition); + assertEquals(expectedRowHeightByPosition, actualRowHeightByPosition); } // Row resize for (int rowPosition = 0; rowPosition < expectedRowCount; rowPosition++) { - boolean expectedRowPositionResizable = expectedLayer - .isRowPositionResizable(rowPosition); - boolean actualRowPositionResizable = actualLayer - .isRowPositionResizable(rowPosition); - assertEquals("Row position resizable (" + rowPosition + ")", - expectedRowPositionResizable, actualRowPositionResizable); + boolean expectedRowPositionResizable = expectedLayer.isRowPositionResizable(rowPosition); + boolean actualRowPositionResizable = actualLayer.isRowPositionResizable(rowPosition); + assertEquals(expectedRowPositionResizable, actualRowPositionResizable); } // Y @@ -195,83 +157,55 @@ public class LayerAssert { for (int y = 0; y < expectedHeight; y++) { int expectedRowPositionByY = expectedLayer.getRowPositionByY(y); int actualRowPositionByY = actualLayer.getRowPositionByY(y); - assertEquals("Row position by Y (" + y + ")", - expectedRowPositionByY, actualRowPositionByY); + assertEquals(expectedRowPositionByY, actualRowPositionByY); } for (int rowPosition = 0; rowPosition < expectedRowCount; rowPosition++) { - int expectedStartYOfRowPosition = expectedLayer - .getStartYOfRowPosition(rowPosition); - int actualStartYOfRowPosition = actualLayer - .getStartYOfRowPosition(rowPosition); - assertEquals( - "Start Y of row position (" + rowPosition + ")", - expectedStartYOfRowPosition, actualStartYOfRowPosition); + int expectedStartYOfRowPosition = expectedLayer.getStartYOfRowPosition(rowPosition); + int actualStartYOfRowPosition = actualLayer.getStartYOfRowPosition(rowPosition); + assertEquals(expectedStartYOfRowPosition, actualStartYOfRowPosition); } // Cell features for (int columnPosition = 0; columnPosition < expectedColumnCount; columnPosition++) { for (int rowPosition = 0; rowPosition < expectedRowCount; rowPosition++) { - ILayerCell expectedCellByPosition = expectedLayer - .getCellByPosition(columnPosition, rowPosition); - ILayerCell actualCellByPosition = actualLayer - .getCellByPosition(columnPosition, rowPosition); - assertEquals("Cell by position (" + columnPosition - + ", " + rowPosition + ")", expectedCellByPosition, - actualCellByPosition); + ILayerCell expectedCellByPosition = expectedLayer.getCellByPosition(columnPosition, rowPosition); + ILayerCell actualCellByPosition = actualLayer.getCellByPosition(columnPosition, rowPosition); + assertEquals(expectedCellByPosition, actualCellByPosition); } } for (int columnPosition = 0; columnPosition < expectedColumnCount; columnPosition++) { for (int rowPosition = 0; rowPosition < expectedRowCount; rowPosition++) { - Rectangle expectedBoundsByPosition = expectedLayer - .getBoundsByPosition(columnPosition, rowPosition); - Rectangle actualBoundsByPosition = actualLayer - .getBoundsByPosition(columnPosition, rowPosition); - assertEquals("Bounds by position (" + columnPosition - + ", " + rowPosition + ")", expectedBoundsByPosition, - actualBoundsByPosition); + Rectangle expectedBoundsByPosition = expectedLayer.getBoundsByPosition(columnPosition, rowPosition); + Rectangle actualBoundsByPosition = actualLayer.getBoundsByPosition(columnPosition, rowPosition); + assertEquals(expectedBoundsByPosition, actualBoundsByPosition); } } for (int columnPosition = 0; columnPosition < expectedColumnCount; columnPosition++) { for (int rowPosition = 0; rowPosition < expectedRowCount; rowPosition++) { - DisplayMode expectedDisplayModeByPosition = expectedLayer - .getDisplayModeByPosition(columnPosition, rowPosition); - DisplayMode actualDisplayModeByPosition = actualLayer - .getDisplayModeByPosition(columnPosition, rowPosition); - assertEquals("Display mode by position (" - + columnPosition + ", " + rowPosition + ")", - expectedDisplayModeByPosition, - actualDisplayModeByPosition); + DisplayMode expectedDisplayModeByPosition = expectedLayer.getDisplayModeByPosition(columnPosition, rowPosition); + DisplayMode actualDisplayModeByPosition = actualLayer.getDisplayModeByPosition(columnPosition, rowPosition); + assertEquals(expectedDisplayModeByPosition, actualDisplayModeByPosition); } } for (int columnPosition = 0; columnPosition < expectedColumnCount; columnPosition++) { for (int rowPosition = 0; rowPosition < expectedRowCount; rowPosition++) { - LabelStack expectedConfigLabelsByPosition = expectedLayer - .getConfigLabelsByPosition(columnPosition, rowPosition); - LabelStack actualConfigLabelsByPosition = actualLayer - .getConfigLabelsByPosition(columnPosition, rowPosition); - assertEquals("Config labels by position (" - + columnPosition + ", " + rowPosition + ")", - expectedConfigLabelsByPosition, - actualConfigLabelsByPosition); + LabelStack expectedConfigLabelsByPosition = expectedLayer.getConfigLabelsByPosition(columnPosition, rowPosition); + LabelStack actualConfigLabelsByPosition = actualLayer.getConfigLabelsByPosition(columnPosition, rowPosition); + assertEquals(expectedConfigLabelsByPosition, actualConfigLabelsByPosition); } } for (int columnPosition = 0; columnPosition < expectedColumnCount; columnPosition++) { for (int rowPosition = 0; rowPosition < expectedRowCount; rowPosition++) { - Object expectedDataValueByPosition = expectedLayer - .getDataValueByPosition(columnPosition, rowPosition); - Object actualDataValueByPosition = actualLayer - .getDataValueByPosition(columnPosition, rowPosition); - assertEquals("Data value by position (" + columnPosition - + ", " + rowPosition + ")", - expectedDataValueByPosition, actualDataValueByPosition); + Object expectedDataValueByPosition = expectedLayer.getDataValueByPosition(columnPosition, rowPosition); + Object actualDataValueByPosition = actualLayer.getDataValueByPosition(columnPosition, rowPosition); + assertEquals(expectedDataValueByPosition, actualDataValueByPosition); } } } - } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/TestLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/TestLayerTest.java index 5cc6839f..2fff9892 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/TestLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/TestLayerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -14,14 +14,14 @@ package org.eclipse.nebula.widgets.nattable.test; import org.eclipse.nebula.widgets.nattable.layer.ILayer; import org.eclipse.nebula.widgets.nattable.test.fixture.TestLayer; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class TestLayerTest { private ILayer testLayer; - @Before + @BeforeEach public void setup() { String columnInfo = "0:0;100 | 1:1;100 | 2:2;100 | 3:3;100"; String rowInfo = "0:0;40 | 1:1;40 | 2:2;40 | 3:3;40"; diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/TestLayer.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/TestLayer.java index f8393308..72609225 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/TestLayer.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/TestLayer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -34,9 +34,9 @@ import org.eclipse.nebula.widgets.nattable.style.DisplayMode; import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry; import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Ignore; +import org.junit.jupiter.api.Disabled; -@Ignore +@Disabled public class TestLayer implements IUniqueIndexLayer { private final int columnCount; diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/TestLayerCell.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/TestLayerCell.java index 76666b5a..d862b32b 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/TestLayerCell.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/TestLayerCell.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -16,9 +16,9 @@ import org.eclipse.nebula.widgets.nattable.layer.ILayer; import org.eclipse.nebula.widgets.nattable.layer.cell.DataCell; import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell; import org.eclipse.nebula.widgets.nattable.layer.cell.LayerCell; -import org.junit.Ignore; +import org.junit.jupiter.api.Disabled; -@Ignore +@Disabled public class TestLayerCell extends LayerCell { public TestLayerCell(ILayer layer, int columnPosition, int rowPosition) { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/group/ColumnGroupModelFixture.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/group/ColumnGroupModelFixture.java index 068f8fac..88cea5b4 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/group/ColumnGroupModelFixture.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/group/ColumnGroupModelFixture.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,10 +12,12 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.test.fixture.group; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.util.List; import org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel; -import org.junit.Assert; public class ColumnGroupModelFixture extends ColumnGroupModel { @@ -39,30 +41,29 @@ public class ColumnGroupModelFixture extends ColumnGroupModel { List<Integer> columnIndexesInGroup; columnIndexesInGroup = getColumnGroupByIndex(0).getMembers(); - Assert.assertEquals(2, columnIndexesInGroup.size()); - Assert.assertTrue(columnIndexesInGroup.contains(Integer.valueOf(0))); - Assert.assertTrue(columnIndexesInGroup.contains(Integer.valueOf(1))); + assertEquals(2, columnIndexesInGroup.size()); + assertTrue(columnIndexesInGroup.contains(Integer.valueOf(0))); + assertTrue(columnIndexesInGroup.contains(Integer.valueOf(1))); columnIndexesInGroup = getColumnGroupByIndex(3).getMembers(); - Assert.assertEquals(2, columnIndexesInGroup.size()); - Assert.assertTrue(columnIndexesInGroup.contains(Integer.valueOf(3))); - Assert.assertTrue(columnIndexesInGroup.contains(Integer.valueOf(4))); + assertEquals(2, columnIndexesInGroup.size()); + assertTrue(columnIndexesInGroup.contains(Integer.valueOf(3))); + assertTrue(columnIndexesInGroup.contains(Integer.valueOf(4))); columnIndexesInGroup = getColumnGroupByIndex(10).getMembers(); - Assert.assertEquals(3, columnIndexesInGroup.size()); - Assert.assertTrue(columnIndexesInGroup.contains(Integer.valueOf(10))); - Assert.assertTrue(columnIndexesInGroup.contains(Integer.valueOf(11))); - Assert.assertTrue(columnIndexesInGroup.contains(Integer.valueOf(12))); + assertEquals(3, columnIndexesInGroup.size()); + assertTrue(columnIndexesInGroup.contains(Integer.valueOf(10))); + assertTrue(columnIndexesInGroup.contains(Integer.valueOf(11))); + assertTrue(columnIndexesInGroup.contains(Integer.valueOf(12))); } public void assertTestGroup3IsUnchanged() { - List<Integer> columnIndexesInGroup = getColumnGroupByIndex(10) - .getMembers(); - Assert.assertEquals(3, columnIndexesInGroup.size()); + List<Integer> columnIndexesInGroup = getColumnGroupByIndex(10).getMembers(); + assertEquals(3, columnIndexesInGroup.size()); - Assert.assertTrue(columnIndexesInGroup.contains(Integer.valueOf(10))); - Assert.assertTrue(columnIndexesInGroup.contains(Integer.valueOf(11))); - Assert.assertTrue(columnIndexesInGroup.contains(Integer.valueOf(12))); + assertTrue(columnIndexesInGroup.contains(Integer.valueOf(10))); + assertTrue(columnIndexesInGroup.contains(Integer.valueOf(11))); + assertTrue(columnIndexesInGroup.contains(Integer.valueOf(12))); } } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/layer/ColumnHideShowLayerFixtureTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/layer/ColumnHideShowLayerFixtureTest.java index f32f7af1..a2d16ddc 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/layer/ColumnHideShowLayerFixtureTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/layer/ColumnHideShowLayerFixtureTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,17 +12,17 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.test.fixture.layer; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.layer.ILayer; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnHideShowLayerFixtureTest { private ILayer columnHideShowLayerFixture; - @Before + @BeforeEach public void setup() { this.columnHideShowLayerFixture = new ColumnHideShowLayerFixture(); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/layer/ColumnReorderLayerFixtureTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/layer/ColumnReorderLayerFixtureTest.java index d0b10b65..3c298ea4 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/layer/ColumnReorderLayerFixtureTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/layer/ColumnReorderLayerFixtureTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,82 +12,82 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.test.fixture.layer; +import static org.junit.jupiter.api.Assertions.assertEquals; + import org.eclipse.nebula.widgets.nattable.layer.ILayer; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnReorderLayerFixtureTest { private ILayer columnReorderLayerFixture; - @Before + @BeforeEach public void setup() { this.columnReorderLayerFixture = new ColumnReorderLayerFixture(); } @Test public void testColumnIndexes() { - Assert.assertEquals(4, + assertEquals(4, this.columnReorderLayerFixture.getColumnIndexByPosition(0)); - Assert.assertEquals(1, + assertEquals(1, this.columnReorderLayerFixture.getColumnIndexByPosition(1)); - Assert.assertEquals(0, + assertEquals(0, this.columnReorderLayerFixture.getColumnIndexByPosition(2)); - Assert.assertEquals(2, + assertEquals(2, this.columnReorderLayerFixture.getColumnIndexByPosition(3)); - Assert.assertEquals(3, + assertEquals(3, this.columnReorderLayerFixture.getColumnIndexByPosition(4)); } @Test public void testColumnWidths() { - Assert.assertEquals(80, + assertEquals(80, this.columnReorderLayerFixture.getColumnWidthByPosition(0)); - Assert.assertEquals(100, + assertEquals(100, this.columnReorderLayerFixture.getColumnWidthByPosition(1)); - Assert.assertEquals(150, + assertEquals(150, this.columnReorderLayerFixture.getColumnWidthByPosition(2)); - Assert.assertEquals(35, + assertEquals(35, this.columnReorderLayerFixture.getColumnWidthByPosition(3)); - Assert.assertEquals(100, + assertEquals(100, this.columnReorderLayerFixture.getColumnWidthByPosition(4)); } @Test public void testRowIndexes() { - Assert.assertEquals(0, + assertEquals(0, this.columnReorderLayerFixture.getRowIndexByPosition(0)); - Assert.assertEquals(1, + assertEquals(1, this.columnReorderLayerFixture.getRowIndexByPosition(1)); - Assert.assertEquals(2, + assertEquals(2, this.columnReorderLayerFixture.getRowIndexByPosition(2)); - Assert.assertEquals(3, + assertEquals(3, this.columnReorderLayerFixture.getRowIndexByPosition(3)); - Assert.assertEquals(4, + assertEquals(4, this.columnReorderLayerFixture.getRowIndexByPosition(4)); - Assert.assertEquals(5, + assertEquals(5, this.columnReorderLayerFixture.getRowIndexByPosition(5)); - Assert.assertEquals(6, + assertEquals(6, this.columnReorderLayerFixture.getRowIndexByPosition(6)); } @Test public void testRowHeights() { - Assert.assertEquals(40, + assertEquals(40, this.columnReorderLayerFixture.getRowHeightByPosition(0)); - Assert.assertEquals(70, + assertEquals(70, this.columnReorderLayerFixture.getRowHeightByPosition(1)); - Assert.assertEquals(25, + assertEquals(25, this.columnReorderLayerFixture.getRowHeightByPosition(2)); - Assert.assertEquals(40, + assertEquals(40, this.columnReorderLayerFixture.getRowHeightByPosition(3)); - Assert.assertEquals(50, + assertEquals(50, this.columnReorderLayerFixture.getRowHeightByPosition(4)); - Assert.assertEquals(40, + assertEquals(40, this.columnReorderLayerFixture.getRowHeightByPosition(5)); - Assert.assertEquals(100, + assertEquals(100, this.columnReorderLayerFixture.getRowHeightByPosition(6)); } - -} +}
\ No newline at end of file diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/layer/DataLayerFixtureTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/layer/DataLayerFixtureTest.java index ee6e391c..23107fe1 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/layer/DataLayerFixtureTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/layer/DataLayerFixtureTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,17 +12,17 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.test.fixture.layer; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.layer.ILayer; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class DataLayerFixtureTest { private ILayer dataLayerFixture; - @Before + @BeforeEach public void setup() { this.dataLayerFixture = new DataLayerFixture(); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/layer/RowHideShowLayerFixtureTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/layer/RowHideShowLayerFixtureTest.java index 1b09760a..682fed23 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/layer/RowHideShowLayerFixtureTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/layer/RowHideShowLayerFixtureTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,17 +12,17 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.test.fixture.layer; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.layer.ILayer; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowHideShowLayerFixtureTest { private ILayer rowHideShowLayerFixture; - @Before + @BeforeEach public void setup() { this.rowHideShowLayerFixture = new RowHideShowLayerFixture(); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/layer/RowReorderLayerFixtureTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/layer/RowReorderLayerFixtureTest.java index dd32dd49..d871507f 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/layer/RowReorderLayerFixtureTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/layer/RowReorderLayerFixtureTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2020 Dirk Fauth and others. + * Copyright (c) 2013, 2022 Dirk Fauth and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,17 +12,17 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.test.fixture.layer; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.layer.ILayer; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowReorderLayerFixtureTest { private ILayer rowReorderLayerFixture; - @Before + @BeforeEach public void setup() { this.rowReorderLayerFixture = new RowReorderLayerFixture(); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/ColumnStructuralChangeEventIntegrationTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/ColumnStructuralChangeEventIntegrationTest.java index f8942584..61f80691 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/ColumnStructuralChangeEventIntegrationTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/ColumnStructuralChangeEventIntegrationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2020 Original authors and others. + * Copyright (c) 2016, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.test.integration; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.grid.data.DummyModifiableBodyDataProvider; import org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer; @@ -25,8 +25,8 @@ import org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer; import org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ColumnStructuralChangeEventIntegrationTest { @@ -35,7 +35,7 @@ public class ColumnStructuralChangeEventIntegrationTest { NatTableFixture natTableFixture; LayerListenerFixture listener; - @Before + @BeforeEach public void setup() { this.natTableFixture = new NatTableFixture(this.grid); this.listener = new LayerListenerFixture(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/EditIntegrationTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/EditIntegrationTest.java index 50e1da95..deec39ec 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/EditIntegrationTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/EditIntegrationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,11 +12,11 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.test.integration; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; @@ -70,9 +70,9 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Text; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class EditIntegrationTest { @@ -85,7 +85,7 @@ public class EditIntegrationTest { private NatTableFixture natTable; private DummyGridLayerStack gridLayerStack; - @Before + @BeforeEach public void setup() { this.gridLayerStack = new DummyGridLayerStack(5, 5); this.natTable = new NatTableFixture(this.gridLayerStack); @@ -95,7 +95,7 @@ public class EditIntegrationTest { assertNull(this.natTable.getActiveCellEditor()); } - @After + @AfterEach public void tearDown() { // ensure the editor is closed this.natTable.commitAndCloseActiveCellEditor(); @@ -530,7 +530,7 @@ public class EditIntegrationTest { .getCanonicalValue()); // verify that inline editing is used and not dialog - assertTrue("No InlineCellEditEvent fired", inlineFired[0]); + assertTrue(inlineFired[0], "No InlineCellEditEvent fired"); } @Test diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/PersistenceIntegrationTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/PersistenceIntegrationTest.java index cfc33fa0..0ff8754b 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/PersistenceIntegrationTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/PersistenceIntegrationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.test.integration; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.Properties; @@ -28,8 +28,8 @@ import org.eclipse.nebula.widgets.nattable.resize.command.ColumnResizeCommand; import org.eclipse.nebula.widgets.nattable.resize.command.RowResizeCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class PersistenceIntegrationTest { @@ -37,7 +37,7 @@ public class PersistenceIntegrationTest { private Properties properties; private NatTableFixture natTableFixture; - @Before + @BeforeEach public void setup() { this.natTableFixture = new NatTableFixture(new Shell(), new DummyGridLayerStack() { @@ -57,7 +57,7 @@ public class PersistenceIntegrationTest { } @Test - public void stateIsLoadedCorrectlyFromProperties() throws Exception { + public void stateIsLoadedCorrectlyFromProperties() { saveStateToPropeties(); this.natTableFixture.loadState(TEST_PERSISTENCE_PREFIX, this.properties); @@ -69,7 +69,7 @@ public class PersistenceIntegrationTest { assertEquals(0, this.natTableFixture.getColumnIndexByPosition(3)); } - public void saveStateToPropeties() throws Exception { + public void saveStateToPropeties() { // Resize column 2 to 200px assertEquals(100, this.natTableFixture.getColumnWidthByPosition(2)); this.natTableFixture.doCommand(new ColumnResizeCommand(this.natTableFixture, 2, 200)); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/RenameColumnIntegrationTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/RenameColumnIntegrationTest.java index 45337e57..dd64a4ed 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/RenameColumnIntegrationTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/RenameColumnIntegrationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.test.integration; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.columnRename.RenameColumnHeaderCommand; import org.eclipse.nebula.widgets.nattable.columnRename.event.RenameColumnHeaderEvent; @@ -25,8 +25,8 @@ import org.eclipse.nebula.widgets.nattable.print.command.TurnViewportOffCommand; import org.eclipse.nebula.widgets.nattable.reorder.command.ColumnReorderCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RenameColumnIntegrationTest { @@ -37,7 +37,7 @@ public class RenameColumnIntegrationTest { NatTableFixture natTableFixture; LayerListenerFixture listener; - @Before + @BeforeEach public void setup() { this.natTableFixture = new NatTableFixture(this.grid); this.listener = new LayerListenerFixture(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/RowStructuralChangeEventIntegrationTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/RowStructuralChangeEventIntegrationTest.java index 95e21601..9a024ade 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/RowStructuralChangeEventIntegrationTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/RowStructuralChangeEventIntegrationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2020 Dirk Fauth and others. + * Copyright (c) 2013, 2022 Dirk Fauth and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,7 +12,7 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.test.integration; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.ArrayList; import java.util.Arrays; @@ -41,8 +41,8 @@ import org.eclipse.nebula.widgets.nattable.reorder.command.RowReorderCommand; import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; import org.eclipse.swt.widgets.Shell; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class RowStructuralChangeEventIntegrationTest { @@ -55,7 +55,7 @@ public class RowStructuralChangeEventIntegrationTest { private NatTable natTable; - @Before + @BeforeEach public void setUp() { this.contents = new ArrayList<String>(Arrays.asList("one", "two", "three", "four", "five")); IDataProvider bodyDataProvider = new ListDataProvider<String>(this.contents, diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/SelectionIntegrationTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/SelectionIntegrationTest.java index 726a16a8..74a0c95d 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/SelectionIntegrationTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/SelectionIntegrationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,7 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.test.integration; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate; import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer; @@ -21,9 +22,8 @@ import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.swt.SWT; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Integration test for all default selection behavior. @@ -38,7 +38,7 @@ public class SelectionIntegrationTest { private DefaultGridLayer layerStack; private SelectionLayer selectionLayer; - @Before + @BeforeEach public void setup() { this.layerStack = new DummyGridLayerStack(10, 5); this.selectionLayer = this.layerStack.getBodyLayer().getSelectionLayer(); @@ -46,9 +46,8 @@ public class SelectionIntegrationTest { } @Test - public void movingSelectionWithLeftArrow() throws Exception { - this.natTable.doCommand(new SelectCellCommand(this.natTable, 5, 2, NO_SHIFT, - NO_CTRL)); + public void movingSelectionWithLeftArrow() { + this.natTable.doCommand(new SelectCellCommand(this.natTable, 5, 2, NO_SHIFT, NO_CTRL)); // Note: the co-ordinates from this point on are in selection later // co-ordinates @@ -70,9 +69,8 @@ public class SelectionIntegrationTest { } @Test - public void movingSelectionWithRightArrow() throws Exception { - this.natTable.doCommand(new SelectCellCommand(this.natTable, 5, 2, NO_SHIFT, - NO_CTRL)); + public void movingSelectionWithRightArrow() { + this.natTable.doCommand(new SelectCellCommand(this.natTable, 5, 2, NO_SHIFT, NO_CTRL)); // Note: the co-ordinates from this point on are in selection later // co-ordinates @@ -95,9 +93,8 @@ public class SelectionIntegrationTest { } @Test - public void movingSelectionWithDownArrow() throws Exception { - this.natTable.doCommand(new SelectCellCommand(this.natTable, 5, 2, NO_SHIFT, - NO_CTRL)); + public void movingSelectionWithDownArrow() { + this.natTable.doCommand(new SelectCellCommand(this.natTable, 5, 2, NO_SHIFT, NO_CTRL)); // Note: the co-ordinates from this point on are in selection later // co-ordinates @@ -125,9 +122,8 @@ public class SelectionIntegrationTest { } @Test - public void movingSelectionWithUpArrow() throws Exception { - this.natTable.doCommand(new SelectCellCommand(this.natTable, 5, 4, NO_SHIFT, - NO_CTRL)); + public void movingSelectionWithUpArrow() { + this.natTable.doCommand(new SelectCellCommand(this.natTable, 5, 4, NO_SHIFT, NO_CTRL)); // Note: the co-ordinates from this point on are in selection later // co-ordinates @@ -144,8 +140,7 @@ public class SelectionIntegrationTest { assertCellSelected(4, 2); assertSelectionAnchorEquals(4, 2); - this.natTable.doCommand(new SelectCellCommand(this.natTable, 5, 4, NO_SHIFT, - NO_CTRL)); + this.natTable.doCommand(new SelectCellCommand(this.natTable, 5, 4, NO_SHIFT, NO_CTRL)); assertSelectCellsCount(1); SWTUtils.pressKey(SWT.ARROW_UP, SWT.MOD1, this.natTable); @@ -159,9 +154,8 @@ public class SelectionIntegrationTest { } @Test - public void selectingRectangularAreasWithShiftKey() throws Exception { - this.natTable.doCommand(new SelectCellCommand(this.natTable, 2, 1, NO_SHIFT, - NO_CTRL)); + public void selectingRectangularAreasWithShiftKey() { + this.natTable.doCommand(new SelectCellCommand(this.natTable, 2, 1, NO_SHIFT, NO_CTRL)); this.natTable.doCommand(new SelectCellCommand(this.natTable, 2, 3, SHIFT, NO_CTRL)); assertSelectCellsCount(3); @@ -194,8 +188,7 @@ public class SelectionIntegrationTest { // Convenience asserts private void assertCellSelected(int column, int row) { - PositionCoordinate[] selectedCells = this.selectionLayer - .getSelectedCellPositions(); + PositionCoordinate[] selectedCells = this.selectionLayer.getSelectedCellPositions(); boolean selected = false; for (PositionCoordinate positionCoordinate : selectedCells) { @@ -205,7 +198,7 @@ public class SelectionIntegrationTest { break; } } - Assert.assertTrue(selected); + assertTrue(selected); } private PositionCoordinate[] getSelectedCells() { @@ -220,10 +213,8 @@ public class SelectionIntegrationTest { assertPositionEquals(column, row, this.selectionLayer.getSelectionAnchor()); } - private void assertPositionEquals(int column, int row, - PositionCoordinate position) { + private void assertPositionEquals(int column, int row, PositionCoordinate position) { assertEquals(column, position.getColumnPosition()); assertEquals(row, position.getRowPosition()); } - -} +}
\ No newline at end of file diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/tickupdate/command/DefaultTickUpdateHandlerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/tickupdate/command/DefaultTickUpdateHandlerTest.java index 1e204048..c9211aa7 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/tickupdate/command/DefaultTickUpdateHandlerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/tickupdate/command/DefaultTickUpdateHandlerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2020 Dirk Fauth. + * Copyright (c) 2017, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,13 +12,13 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.tickupdate.command; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService; import org.eclipse.nebula.widgets.nattable.tickupdate.ITickUpdateHandler; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DefaultTickUpdateHandlerTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/tickupdate/command/TickUpdateCommandHandlerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/tickupdate/command/TickUpdateCommandHandlerTest.java index c8b8d89d..75e47982 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/tickupdate/command/TickUpdateCommandHandlerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/tickupdate/command/TickUpdateCommandHandlerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -13,8 +13,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.tickupdate.command; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; import java.util.Arrays; @@ -25,18 +25,16 @@ import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor; import org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor; import org.eclipse.nebula.widgets.nattable.grid.cell.AlternatingRowConfigLabelAccumulator; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; -import org.eclipse.nebula.widgets.nattable.layer.ILayerListener; import org.eclipse.nebula.widgets.nattable.layer.cell.AggregateConfigLabelAccumulator; import org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator; import org.eclipse.nebula.widgets.nattable.layer.event.CellVisualChangeEvent; -import org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent; import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; import org.eclipse.nebula.widgets.nattable.style.DisplayMode; import org.eclipse.nebula.widgets.nattable.test.fixture.TickUpdateHandlerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.tickupdate.TickUpdateConfigAttributes; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class TickUpdateCommandHandlerTest { @@ -45,7 +43,7 @@ public class TickUpdateCommandHandlerTest { private TickUpdateCommandHandler commandHandler; private ColumnOverrideLabelAccumulator columnLabelAccumulator; - @Before + @BeforeEach public void setup() { DataLayerFixture bodyDataLayer = new DataLayerFixture(); this.selectionLayer = new SelectionLayer(bodyDataLayer); @@ -71,21 +69,21 @@ public class TickUpdateCommandHandlerTest { } @Test - public void shouldIncrementCellValue() throws Exception { + public void shouldIncrementCellValue() { assertEquals("[1, 1]", this.selectionLayer.getDataValueByPosition(1, 1)); this.commandHandler.doCommand(new TickUpdateCommand(this.testConfigRegistry, true)); assertEquals("[1, 1]up", this.selectionLayer.getDataValueByPosition(1, 1)); } @Test - public void shouldDecrementCellValue() throws Exception { + public void shouldDecrementCellValue() { assertEquals("[1, 1]", this.selectionLayer.getDataValueByPosition(1, 1)); this.commandHandler.doCommand(new TickUpdateCommand(this.testConfigRegistry, false)); assertEquals("[1, 1]down", this.selectionLayer.getDataValueByPosition(1, 1)); } @Test - public void shouldNotUpdateAnUneditableCell() throws Exception { + public void shouldNotUpdateAnUneditableCell() { this.testConfigRegistry.registerConfigAttribute( EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.NEVER_EDITABLE); @@ -102,7 +100,7 @@ public class TickUpdateCommandHandlerTest { } @Test - public void shouldUpdateMultipleCellsInSelection() throws Exception { + public void shouldUpdateMultipleCellsInSelection() { this.selectionLayer.selectCell(1, 2, false, true); this.selectionLayer.selectCell(1, 5, false, true); @@ -120,7 +118,7 @@ public class TickUpdateCommandHandlerTest { } @Test - public void shouldUpdateOnlyIfAllCellsHaveTheSameEditor() throws Exception { + public void shouldUpdateOnlyIfAllCellsHaveTheSameEditor() { this.columnLabelAccumulator.registerColumnOverrides(1, "COMBO_BOX_EDITOR_LABEL"); this.columnLabelAccumulator.registerColumnOverrides(2, "TEXT_BOX_EDITOR_LABEL"); @@ -169,13 +167,9 @@ public class TickUpdateCommandHandlerTest { // we also check that no update has been triggered this.selectionLayer.clear(); - this.selectionLayer.addLayerListener(new ILayerListener() { - - @Override - public void handleLayerEvent(ILayerEvent event) { - if (event instanceof CellVisualChangeEvent) { - fail("update triggered"); - } + this.selectionLayer.addLayerListener(event -> { + if (event instanceof CellVisualChangeEvent) { + fail("update triggered"); } }); this.commandHandler.doCommand(new TickUpdateCommand(this.testConfigRegistry, true)); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/tree/TreeLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/tree/TreeLayerTest.java index a7fcd39b..ee2b81e7 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/tree/TreeLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/tree/TreeLayerTest.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2020 Dirk Fauth. + * Copyright (c) 2020, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,9 +12,9 @@ *****************************************************************************/ package org.eclipse.nebula.widgets.nattable.tree; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.ArrayList; import java.util.Collection; @@ -42,15 +42,15 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixtu import org.eclipse.nebula.widgets.nattable.tree.command.TreeCollapseAllCommand; import org.eclipse.nebula.widgets.nattable.tree.command.TreeExpandAllCommand; import org.eclipse.nebula.widgets.nattable.tree.command.TreeExpandCollapseCommand; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class TreeLayerTest { private TreeLayer treeLayer; private LayerListenerFixture listener; - @Before + @BeforeEach public void setup() { String[] propertyNames = { "lastName", "firstName", "gender", "married", "birthday" }; IColumnPropertyAccessor<Person> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<>(propertyNames); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/ui/matcher/CellLabelMouseEventMatcherTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/ui/matcher/CellLabelMouseEventMatcherTest.java index 4a555f86..39f1f6a8 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/ui/matcher/CellLabelMouseEventMatcherTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/ui/matcher/CellLabelMouseEventMatcherTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.ui.matcher; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.nebula.widgets.nattable.grid.GridRegion; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; @@ -22,15 +22,15 @@ import org.eclipse.nebula.widgets.nattable.layer.stack.DummyGridLayerStack; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.nebula.widgets.nattable.test.integration.SWTUtils; import org.eclipse.swt.events.MouseEvent; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class CellLabelMouseEventMatcherTest { private static final String TEST_LABEL = "testLabel"; private NatTableFixture natTableFixture; - @Before + @BeforeEach public void setUpCustomCellLabel() { DummyGridLayerStack gridLayerStack = new DummyGridLayerStack(5, 5); this.natTableFixture = new NatTableFixture(gridLayerStack); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/ui/matcher/KeyEventMatcherTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/ui/matcher/KeyEventMatcherTest.java index 6954b58a..201b866e 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/ui/matcher/KeyEventMatcherTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/ui/matcher/KeyEventMatcherTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,13 +12,13 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.ui.matcher; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import java.util.HashMap; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class KeyEventMatcherTest { @@ -41,7 +41,7 @@ public class KeyEventMatcherTest { @Test public void testMap() { - Map<IKeyEventMatcher, String> map = new HashMap<IKeyEventMatcher, String>(); + Map<IKeyEventMatcher, String> map = new HashMap<>(); map.put(new KeyEventMatcher(12, 101), "ABC"); assertEquals(1, map.size()); map.remove(new KeyEventMatcher(12, 101)); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/ui/matcher/LetterOrDigitKeyEventMatcherTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/ui/matcher/LetterOrDigitKeyEventMatcherTest.java index 98493b8c..ac77b507 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/ui/matcher/LetterOrDigitKeyEventMatcherTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/ui/matcher/LetterOrDigitKeyEventMatcherTest.java @@ -12,10 +12,10 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.ui.matcher; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class LetterOrDigitKeyEventMatcherTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/ui/matcher/MouseEventMatcherTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/ui/matcher/MouseEventMatcherTest.java index 7ef5c3b3..3c025f7e 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/ui/matcher/MouseEventMatcherTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/ui/matcher/MouseEventMatcherTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,13 +12,13 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.ui.matcher; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import java.util.HashMap; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class MouseEventMatcherTest { @@ -49,7 +49,7 @@ public class MouseEventMatcherTest { @Test public void testMap() { - Map<IMouseEventMatcher, String> map = new HashMap<IMouseEventMatcher, String>(); + Map<IMouseEventMatcher, String> map = new HashMap<>(); map.put(new MouseEventMatcher(), "ABC"); assertEquals(1, map.size()); map.remove(new MouseEventMatcher()); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/ui/menu/MenuItemProvidersTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/ui/menu/MenuItemProvidersTest.java index 8a1d01b7..572211f3 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/ui/menu/MenuItemProvidersTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/ui/menu/MenuItemProvidersTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.ui.menu; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import org.eclipse.nebula.widgets.nattable.ui.NatEventData; import org.eclipse.swt.SWT; @@ -23,12 +23,12 @@ import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.Shell; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class MenuItemProvidersTest { @Test - public void shouldGetDataFromParentForNestedMenus() throws Exception { + public void shouldGetDataFromParentForNestedMenus() { Display display = Display.getDefault(); Shell shell = new Shell(display); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/util/ArrayUtilTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/util/ArrayUtilTest.java index 7f4a319e..dfd01cee 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/util/ArrayUtilTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/util/ArrayUtilTest.java @@ -12,15 +12,15 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.util; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Collection; import java.util.LinkedList; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ArrayUtilTest { @@ -43,8 +43,8 @@ public class ArrayUtilTest { } @Test - public void conversionToIntArray() throws Exception { - List<Integer> list = new LinkedList<Integer>(); + public void conversionToIntArray() { + List<Integer> list = new LinkedList<>(); list.add(20); list.add(10); list.add(25); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/util/CalculatedValueCacheTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/util/CalculatedValueCacheTest.java index b49e3d47..993fcf34 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/util/CalculatedValueCacheTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/util/CalculatedValueCacheTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2020 Dirk Fauth and others. + * Copyright (c) 2013, 2022 Dirk Fauth and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,32 +12,29 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.util; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; import org.eclipse.nebula.widgets.nattable.grid.data.DummyBodyDataProvider; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; public class CalculatedValueCacheTest { ICalculatedValueCache valueCache; - ICalculator calculator = new ICalculator() { + ICalculator calculator = () -> { - @Override - public Object executeCalculation() { - - // simply add some delay - try { - Thread.sleep(200); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - - return Integer.valueOf(42); + // simply add some delay + try { + Thread.sleep(200); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); } + + return Integer.valueOf(42); }; @Test @@ -186,14 +183,16 @@ public class CalculatedValueCacheTest { assertEquals(Integer.valueOf(42), Integer.valueOf(result.toString())); } - @Test(expected = IllegalStateException.class) + @Test public void testIllegalState() { this.valueCache = new CalculatedValueCache(new DataLayer( new DummyBodyDataProvider(10, 10)), false, false); - this.valueCache.getCalculatedValue(0, 0, false, this.calculator); + assertThrows(IllegalStateException.class, () -> { + this.valueCache.getCalculatedValue(0, 0, false, this.calculator); + }); } - @After + @AfterEach public void tearDown() { this.valueCache.dispose(); } diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/HorizontalScrollBarHandlerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/HorizontalScrollBarHandlerTest.java index 5ddc8581..519605f0 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/HorizontalScrollBarHandlerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/HorizontalScrollBarHandlerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,14 +12,14 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.viewport; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.ViewportLayerFixture; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.ScrollBar; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Test for Horizontal scrolling of the viewport. @@ -35,7 +35,7 @@ public class HorizontalScrollBarHandlerTest { private ScrollBar scrollBar; private HorizontalScrollBarHandler scrollHandler; - @Before + @BeforeEach public void init() { this.viewport = new ViewportLayerFixture(); this.scrollBar = ViewportLayerFixture.DEFAULT_SCROLLABLE.getHorizontalBar(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/ShowInViewportCommandTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/ShowInViewportCommandTest.java index fb6b96c4..59287825 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/ShowInViewportCommandTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/ShowInViewportCommandTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2020 Dirk Fauth. + * Copyright (c) 2018, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,14 +12,14 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.viewport; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.layer.stack.DummyGridLayerStack; import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture; import org.eclipse.nebula.widgets.nattable.viewport.command.ShowCellInViewportCommand; import org.eclipse.nebula.widgets.nattable.viewport.command.ShowColumnInViewportCommand; import org.eclipse.nebula.widgets.nattable.viewport.command.ShowRowInViewportCommand; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ShowInViewportCommandTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/VerticalScrollBarHandlerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/VerticalScrollBarHandlerTest.java index d89ec644..ce4b43c0 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/VerticalScrollBarHandlerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/VerticalScrollBarHandlerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,15 +12,15 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.viewport; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.test.fixture.layer.ViewportLayerFixture; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.ScrollBar; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Test for Vertical scrolling of the viewport. @@ -38,7 +38,7 @@ public class VerticalScrollBarHandlerTest { private VerticalScrollBarHandler scrollHandler; private ScrollBar scrollBar; - @Before + @BeforeEach public void init() { this.viewport = new ViewportLayerFixture(); this.scrollBar = ViewportLayerFixture.DEFAULT_SCROLLABLE.getVerticalBar(); diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/ViewportIntegrationTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/ViewportIntegrationTest.java index 3f694fe6..5b369ba4 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/ViewportIntegrationTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/ViewportIntegrationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2020 Dirk Fauth. + * Copyright (c) 2017, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -31,7 +31,7 @@ import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Shell; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ViewportIntegrationTest { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/ViewportLayerDisposalTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/ViewportLayerDisposalTest.java index 71ca56ec..99992e5e 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/ViewportLayerDisposalTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/ViewportLayerDisposalTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2020 Frank Mosebach. + * Copyright (c) 2014, 2022 Frank Mosebach. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,6 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.viewport; +import static org.junit.jupiter.api.Assertions.assertEquals; + import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.data.IDataProvider; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; @@ -19,21 +21,20 @@ import org.eclipse.nebula.widgets.nattable.layer.event.IStructuralChangeEvent; import org.eclipse.nebula.widgets.nattable.layer.event.StructuralRefreshEvent; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public final class ViewportLayerDisposalTest { private Shell shell; - @Before + @BeforeEach public void init() { this.shell = new Shell(Display.getDefault()); } - @After + @AfterEach public void dispose() { this.shell.dispose(); } @@ -80,7 +81,7 @@ public final class ViewportLayerDisposalTest { // Test that the background thread has successfully updated the table's // data layer. - Assert.assertEquals("The table's data layer should have been updated.", "VALUE", dataLayer.getDataValue(4, 49)); + assertEquals("VALUE", dataLayer.getDataValue(4, 49), "The table's data layer should have been updated."); } private static final class TestDataLayer extends DataLayer { diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/ViewportLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/ViewportLayerTest.java index 81ebd694..7cae06c2 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/ViewportLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/ViewportLayerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.viewport; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent; import org.eclipse.nebula.widgets.nattable.layer.event.IVisualChangeEvent; @@ -26,21 +26,21 @@ import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixtu import org.eclipse.nebula.widgets.nattable.test.fixture.layer.ViewportLayerFixture; import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider; import org.eclipse.swt.graphics.Rectangle; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ViewportLayerTest { protected ViewportLayer viewportLayer; protected LayerListenerFixture layerListener; - @Before + @BeforeEach public void setup() { this.viewportLayer = new ViewportLayerFixture(); this.layerListener = new LayerListenerFixture(); } - @After + @AfterEach public void resertStaticFieldsInViewportFixture() { this.viewportLayer.getClientAreaProvider().getClientArea().x = 0; this.viewportLayer.getClientAreaProvider().getClientArea().y = 0; diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/ViewportLayerTest2.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/ViewportLayerTest2.java index 036a5a98..4c104f19 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/ViewportLayerTest2.java +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/viewport/ViewportLayerTest2.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -14,17 +14,16 @@ package org.eclipse.nebula.widgets.nattable.viewport; import org.eclipse.nebula.widgets.nattable.test.LayerAssert; import org.eclipse.nebula.widgets.nattable.test.fixture.TestLayer; -import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider; import org.eclipse.swt.graphics.Rectangle; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ViewportLayerTest2 { private TestLayer dataLayer; private ViewportLayer viewportLayer; - @Before + @BeforeEach public void setup() { String columnInfo = "0:0;100 | 1:1;100 | 2:2;100 | 3:3;100"; String rowInfo = "0:0;40 | 1:1;40 | 2:2;40 | 3:3;40"; @@ -35,14 +34,7 @@ public class ViewportLayerTest2 { this.dataLayer = new TestLayer(4, 4, columnInfo, rowInfo, cellInfo); this.viewportLayer = new ViewportLayer(this.dataLayer); - this.viewportLayer.setClientAreaProvider(new IClientAreaProvider() { - - @Override - public Rectangle getClientArea() { - return new Rectangle(0, 0, 200, 400); - } - - }); + this.viewportLayer.setClientAreaProvider(() -> new Rectangle(0, 0, 200, 400)); } @Test diff --git a/org.eclipse.nebula.widgets.nattable.dataset.test/META-INF/MANIFEST.MF b/org.eclipse.nebula.widgets.nattable.dataset.test/META-INF/MANIFEST.MF index a2ac0235..5e8c4794 100644 --- a/org.eclipse.nebula.widgets.nattable.dataset.test/META-INF/MANIFEST.MF +++ b/org.eclipse.nebula.widgets.nattable.dataset.test/META-INF/MANIFEST.MF @@ -5,7 +5,6 @@ Bundle-SymbolicName: org.eclipse.nebula.widgets.nattable.dataset.test Bundle-Version: 2.0.0.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Fragment-Host: org.eclipse.nebula.widgets.nattable.dataset -Import-Package: org.hamcrest.core;version="1.1.0", - org.junit +Import-Package: org.junit.jupiter.api;version="5.9.1" Bundle-Vendor: Eclipse Nebula NatTable Automatic-Module-Name: org.eclipse.nebula.widgets.nattable.dataset.test diff --git a/org.eclipse.nebula.widgets.nattable.dataset.test/src/org/eclipse/nebula/widgets/nattable/dataset/generator/DataGeneratorTest.java b/org.eclipse.nebula.widgets.nattable.dataset.test/src/org/eclipse/nebula/widgets/nattable/dataset/generator/DataGeneratorTest.java index f907b07d..ebb40a83 100644 --- a/org.eclipse.nebula.widgets.nattable.dataset.test/src/org/eclipse/nebula/widgets/nattable/dataset/generator/DataGeneratorTest.java +++ b/org.eclipse.nebula.widgets.nattable.dataset.test/src/org/eclipse/nebula/widgets/nattable/dataset/generator/DataGeneratorTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,12 +12,12 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.dataset.generator; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import org.eclipse.nebula.widgets.nattable.dataset.pricing.PricingDataBean; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DataGeneratorTest { diff --git a/org.eclipse.nebula.widgets.nattable.dataset.test/src/org/eclipse/nebula/widgets/nattable/dataset/pricing/DataValueGeneratorTest.java b/org.eclipse.nebula.widgets.nattable.dataset.test/src/org/eclipse/nebula/widgets/nattable/dataset/pricing/DataValueGeneratorTest.java index e3a08d31..52a62e77 100644 --- a/org.eclipse.nebula.widgets.nattable.dataset.test/src/org/eclipse/nebula/widgets/nattable/dataset/pricing/DataValueGeneratorTest.java +++ b/org.eclipse.nebula.widgets.nattable.dataset.test/src/org/eclipse/nebula/widgets/nattable/dataset/pricing/DataValueGeneratorTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,15 +12,15 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.dataset.pricing; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.lang.reflect.Field; import java.util.Random; import org.eclipse.nebula.widgets.nattable.dataset.generator.DataValueGenerator; import org.eclipse.nebula.widgets.nattable.dataset.generator.IValueGenerator; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DataValueGeneratorTest { diff --git a/org.eclipse.nebula.widgets.nattable.dataset.test/src/org/eclipse/nebula/widgets/nattable/dataset/pricing/PricingDataTester.java b/org.eclipse.nebula.widgets.nattable.dataset.test/src/org/eclipse/nebula/widgets/nattable/dataset/pricing/PricingDataTester.java index dfd1e26c..450561d6 100644 --- a/org.eclipse.nebula.widgets.nattable.dataset.test/src/org/eclipse/nebula/widgets/nattable/dataset/pricing/PricingDataTester.java +++ b/org.eclipse.nebula.widgets.nattable.dataset.test/src/org/eclipse/nebula/widgets/nattable/dataset/pricing/PricingDataTester.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,16 +12,17 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.dataset.pricing; +import static org.junit.jupiter.api.Assertions.assertEquals; + import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.List; import java.util.StringTokenizer; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -@Ignore +@Disabled public class PricingDataTester { @Test @@ -35,7 +36,7 @@ public class PricingDataTester { while (reader.read() >= 0) { final StringTokenizer tabbedData = reader .getTabbedLineRead(); - Assert.assertEquals(18, tabbedData.countTokens()); + assertEquals(18, tabbedData.countTokens()); } } } finally { @@ -47,7 +48,7 @@ public class PricingDataTester { public void loadAPSBeans() throws Exception { final PricingDataFileLoader<PricingDataBean> gen = new PricingDataFileLoader<PricingDataBean>(); final List<PricingDataBean> data = gen.loadDataFromFile(); - Assert.assertEquals(46, data.size()); - Assert.assertEquals("USA 4 15FEB15".trim(), data.get(28).getIsin()); + assertEquals(46, data.size()); + assertEquals("USA 4 15FEB15".trim(), data.get(28).getIsin()); } } diff --git a/org.eclipse.nebula.widgets.nattable.examples.e4.product/pom.xml b/org.eclipse.nebula.widgets.nattable.examples.e4.product/pom.xml index 214d35c8..78f0bae2 100644 --- a/org.eclipse.nebula.widgets.nattable.examples.e4.product/pom.xml +++ b/org.eclipse.nebula.widgets.nattable.examples.e4.product/pom.xml @@ -113,7 +113,6 @@ <configuration> <signFiles> <signFile>${project.build.directory}/products/${product-folder}/win32/win32/x86_64/nattable_examples.exe</signFile> - <signFile>${project.build.directory}/products/${product-folder}/win32/win32/x86_64/eclipsec.exe</signFile> </signFiles> </configuration> </execution> diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/.classpath b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/.classpath index b629a6a2..22f30643 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/.classpath +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/.classpath @@ -3,6 +3,5 @@ <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/META-INF/MANIFEST.MF b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/META-INF/MANIFEST.MF index 0f6e96d8..372625ea 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/META-INF/MANIFEST.MF +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/META-INF/MANIFEST.MF @@ -23,8 +23,7 @@ Import-Package: org.eclipse.jface.viewers, org.eclipse.nebula.widgets.nattable.test.integration, org.eclipse.nebula.widgets.nattable.tree.command, org.eclipse.nebula.widgets.nattable.viewport, - org.junit.jupiter.api;version="5.5.1" + org.junit.jupiter.api;version="5.9.1" Bundle-Vendor: Eclipse Nebula NatTable -Require-Bundle: ca.odell.glazedlists;bundle-version="1.9.0", - org.junit;bundle-version="4.12.0" +Require-Bundle: ca.odell.glazedlists;bundle-version="1.9.0" Automatic-Module-Name: org.eclipse.nebula.widgets.nattable.extension.glazedlists.tests diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/ComboBoxFilterRowHeaderCompositeIntegrationTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/ComboBoxFilterRowHeaderCompositeIntegrationTest.java index 47f5f724..359d7ba3 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/ComboBoxFilterRowHeaderCompositeIntegrationTest.java +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/ComboBoxFilterRowHeaderCompositeIntegrationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2020 Dirk Fauth. + * Copyright (c) 2019, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,8 +12,8 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.extension.glazedlists.filterrow; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.ArrayList; import java.util.Arrays; @@ -71,12 +71,12 @@ import org.eclipse.nebula.widgets.nattable.sort.SortHeaderLayer; import org.eclipse.nebula.widgets.nattable.sort.config.DefaultSortConfiguration; import org.eclipse.nebula.widgets.nattable.tree.TreeLayer; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import ca.odell.glazedlists.EventList; import ca.odell.glazedlists.FilterList; @@ -100,7 +100,7 @@ public class ComboBoxFilterRowHeaderCompositeIntegrationTest { private static GlazedListsSortModel<ExtendedPersonWithAddress> sortModel; - @BeforeClass + @BeforeAll public static void setupClass() { // create a new ConfigRegistry which will be needed for GlazedLists // handling @@ -218,18 +218,18 @@ public class ComboBoxFilterRowHeaderCompositeIntegrationTest { natTable.configure(); } - @Before + @BeforeEach public void setup() { // test that nothing is filtered assertEquals(9000, bodyLayer.getFilterList().size()); } - @After + @AfterEach public void tearDown() { natTable.doCommand(new ClearAllFiltersCommand()); } - @AfterClass + @AfterAll public static void tearDownClass() { natTable.doCommand(new DisposeResourcesCommand()); } @@ -284,7 +284,7 @@ public class ComboBoxFilterRowHeaderCompositeIntegrationTest { } // TODO should not remove filter on sort - @Ignore + @Disabled @Test public void shouldKeepFilterOnSort() throws InterruptedException { shouldFilterForMaleSimpsons(); @@ -326,7 +326,7 @@ public class ComboBoxFilterRowHeaderCompositeIntegrationTest { boolean completed = countDown.await(2000, TimeUnit.MILLISECONDS); - assertTrue("Timeout - no event received", completed); + assertTrue(completed, "Timeout - no event received"); assertEquals(1, listener.getEventsCount()); @@ -354,7 +354,7 @@ public class ComboBoxFilterRowHeaderCompositeIntegrationTest { completed = countDown.await(2000, TimeUnit.MILLISECONDS); - assertTrue("Timeout - no event received", completed); + assertTrue(completed, "Timeout - no event received"); assertEquals(1, listener.getEventsCount()); @@ -403,7 +403,7 @@ public class ComboBoxFilterRowHeaderCompositeIntegrationTest { // long end = System.currentTimeMillis(); // System.out.println("duration " + (end - start)); - assertTrue("Timeout - no event received", completed); + assertTrue(completed, "Timeout - no event received"); assertEquals(2, listener.getEventsCount()); @@ -443,7 +443,7 @@ public class ComboBoxFilterRowHeaderCompositeIntegrationTest { // end = System.currentTimeMillis(); // System.out.println("duration " + (end - start)); - assertTrue("Timeout - no event received", completed); + assertTrue(completed, "Timeout - no event received"); filterRowHeaderLayer.comboBoxDataProvider.removeCacheUpdateListener(listener); } diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/ComboBoxGlazedListsFilterStrategyTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/ComboBoxGlazedListsFilterStrategyTest.java index f0d0c32c..bbef7b0e 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/ComboBoxGlazedListsFilterStrategyTest.java +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/ComboBoxGlazedListsFilterStrategyTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2020 Dirk Fauth. + * Copyright (c) 2017, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.extension.glazedlists.filterrow; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.ArrayList; import java.util.Arrays; @@ -31,9 +31,9 @@ import org.eclipse.nebula.widgets.nattable.filterrow.combobox.ComboBoxFilterRowC import org.eclipse.nebula.widgets.nattable.filterrow.combobox.FilterRowComboBoxDataProvider; import org.eclipse.nebula.widgets.nattable.filterrow.config.DefaultFilterRowConfiguration; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import ca.odell.glazedlists.EventList; import ca.odell.glazedlists.FilterList; @@ -65,7 +65,7 @@ public class ComboBoxGlazedListsFilterStrategyTest { } }; - @BeforeClass + @BeforeAll public static void init() { // initialize the collection with a big amount of values EventList<Person> baseCollection = GlazedLists.eventList(PersonService.getFixedPersons()); @@ -99,7 +99,7 @@ public class ComboBoxGlazedListsFilterStrategyTest { columnHeaderLayer.getDataProvider(), configRegistry); } - @Before + @BeforeEach public void setup() { for (int i = 0; i < dataProvider.getColumnCount(); i++) { dataProvider.getFilterIndexToObjectMap().put(i, EditConstants.SELECT_ALL_ITEMS_VALUE); diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/DefaultGlazedListsFilterStrategyTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/DefaultGlazedListsFilterStrategyTest.java index a4bc730e..0f539912 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/DefaultGlazedListsFilterStrategyTest.java +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/DefaultGlazedListsFilterStrategyTest.java @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.extension.glazedlists.filterrow; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry; import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration; @@ -30,9 +30,9 @@ import org.eclipse.nebula.widgets.nattable.filterrow.TextMatchingMode; import org.eclipse.nebula.widgets.nattable.filterrow.config.DefaultFilterRowConfiguration; import org.eclipse.nebula.widgets.nattable.filterrow.config.FilterRowConfigAttributes; import org.eclipse.nebula.widgets.nattable.style.DisplayMode; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import ca.odell.glazedlists.EventList; import ca.odell.glazedlists.FilterList; @@ -54,7 +54,7 @@ public class DefaultGlazedListsFilterStrategyTest { "birthday", "money" }; - @BeforeClass + @BeforeAll public static void init() { // initialize the collection with a big amount of values filterList = new FilterList<>(GlazedLists.eventList(PersonService.getFixedPersons())); @@ -76,7 +76,7 @@ public class DefaultGlazedListsFilterStrategyTest { columnHeaderLayer.getDataProvider(), configRegistry); } - @Before + @BeforeEach public void setup() { // ensure to start over with a clear filter dataProvider.clearAllFilters(); diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/DefaultGlazedListsStaticFilterStrategyTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/DefaultGlazedListsStaticFilterStrategyTest.java index d2c93622..660e1636 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/DefaultGlazedListsStaticFilterStrategyTest.java +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/DefaultGlazedListsStaticFilterStrategyTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2020 Dirk Fauth. + * Copyright (c) 2017, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,7 +12,7 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.extension.glazedlists.filterrow; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry; import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration; @@ -22,9 +22,9 @@ import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService; import org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.DataLayerFixture; import org.eclipse.nebula.widgets.nattable.filterrow.FilterRowDataProvider; import org.eclipse.nebula.widgets.nattable.filterrow.config.DefaultFilterRowConfiguration; -import org.junit.After; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import ca.odell.glazedlists.FilterList; import ca.odell.glazedlists.GlazedLists; @@ -54,7 +54,7 @@ public class DefaultGlazedListsStaticFilterStrategyTest { } }; - @BeforeClass + @BeforeAll public static void init() { // initialize the collection with a big amount of values filterList = new FilterList<>(GlazedLists.eventList(PersonService.getFixedPersons())); @@ -77,7 +77,7 @@ public class DefaultGlazedListsStaticFilterStrategyTest { columnHeaderLayer.getDataProvider(), configRegistry); } - @After + @AfterEach public void tearDown() { // ensure to start over with a clear filter dataProvider.clearAllFilters(); diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowDataLayerTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowDataLayerTest.java index 9cc14ff0..32442f51 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowDataLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowDataLayerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.extension.glazedlists.filterrow; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.fail; import java.util.Properties; @@ -33,8 +33,8 @@ import org.eclipse.nebula.widgets.nattable.filterrow.command.ClearFilterCommand; import org.eclipse.nebula.widgets.nattable.filterrow.command.ToggleFilterRowCommand; import org.eclipse.nebula.widgets.nattable.filterrow.config.DefaultFilterRowConfiguration; import org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralRefreshEvent; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import ca.odell.glazedlists.FilterList; import ca.odell.glazedlists.GlazedLists; @@ -47,7 +47,7 @@ public class FilterRowDataLayerTest { private FilterRowDataLayer<RowDataFixture> layerUnderTest; private LayerListenerFixture listener; - @Before + @BeforeEach public void setup() { this.columnHeaderLayer = new DataLayerFixture(10, 2, 100, 50); diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowHeaderCompositeTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowHeaderCompositeTest.java index f7c6f8ed..4010ccc3 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowHeaderCompositeTest.java +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowHeaderCompositeTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,6 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.extension.glazedlists.filterrow; +import static org.junit.jupiter.api.Assertions.assertEquals; + import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry; import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration; import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry; @@ -27,9 +29,8 @@ import org.eclipse.nebula.widgets.nattable.filterrow.command.ClearFilterCommand; import org.eclipse.nebula.widgets.nattable.filterrow.command.ToggleFilterRowCommand; import org.eclipse.nebula.widgets.nattable.filterrow.config.DefaultFilterRowConfiguration; import org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralRefreshEvent; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import ca.odell.glazedlists.FilterList; import ca.odell.glazedlists.GlazedLists; @@ -42,7 +43,7 @@ public class FilterRowHeaderCompositeTest { private FilterRowHeaderComposite<RowDataFixture> layerUnderTest; private LayerListenerFixture listener; - @Before + @BeforeEach public void setup() { this.columnHeaderLayer = new DataLayerFixture(10, 2, 100, 50); @@ -68,51 +69,48 @@ public class FilterRowHeaderCompositeTest { @Test public void shouldHandleClearFilterCommand() throws Exception { - Assert.assertEquals(13, this.filterList.size()); + assertEquals(13, this.filterList.size()); - this.layerUnderTest.doCommand(new UpdateDataCommand(this.layerUnderTest, 1, 2, - "ford")); - Assert.assertEquals(1, this.filterList.size()); + this.layerUnderTest.doCommand(new UpdateDataCommand(this.layerUnderTest, 1, 2, "ford")); + assertEquals(1, this.filterList.size()); this.layerUnderTest.doCommand(new ClearFilterCommand(this.layerUnderTest, 1)); - Assert.assertEquals(13, this.filterList.size()); + assertEquals(13, this.filterList.size()); this.listener.containsInstanceOf(RowStructuralRefreshEvent.class); } @Test public void shouldHandleTheClearAllFiltersCommand() throws Exception { - Assert.assertEquals(13, this.filterList.size()); + assertEquals(13, this.filterList.size()); - this.layerUnderTest.doCommand(new UpdateDataCommand(this.layerUnderTest, 1, 2, - "ford")); - Assert.assertEquals(1, this.filterList.size()); + this.layerUnderTest.doCommand(new UpdateDataCommand(this.layerUnderTest, 1, 2, "ford")); + assertEquals(1, this.filterList.size()); - this.layerUnderTest.doCommand(new UpdateDataCommand(this.layerUnderTest, 0, 2, - "XXX")); - Assert.assertEquals(0, this.filterList.size()); + this.layerUnderTest.doCommand(new UpdateDataCommand(this.layerUnderTest, 0, 2, "XXX")); + assertEquals(0, this.filterList.size()); this.layerUnderTest.doCommand(new ClearAllFiltersCommand()); - Assert.assertEquals(13, this.filterList.size()); + assertEquals(13, this.filterList.size()); this.listener.containsInstanceOf(RowStructuralRefreshEvent.class); } @Test public void shouldHandleTheToggeleFilterRowCommand() throws Exception { - Assert.assertEquals(3, this.layerUnderTest.getRowCount()); + assertEquals(3, this.layerUnderTest.getRowCount()); this.layerUnderTest.doCommand(new ToggleFilterRowCommand()); - Assert.assertEquals(2, this.layerUnderTest.getRowCount()); + assertEquals(2, this.layerUnderTest.getRowCount()); this.layerUnderTest.doCommand(new ToggleFilterRowCommand()); - Assert.assertEquals(3, this.layerUnderTest.getRowCount()); + assertEquals(3, this.layerUnderTest.getRowCount()); } @Test public void shouldSwitchVisibilityProgrammatically() throws Exception { - Assert.assertEquals(3, this.layerUnderTest.getRowCount()); + assertEquals(3, this.layerUnderTest.getRowCount()); this.layerUnderTest.setFilterRowVisible(false); - Assert.assertEquals(2, this.layerUnderTest.getRowCount()); + assertEquals(2, this.layerUnderTest.getRowCount()); this.layerUnderTest.setFilterRowVisible(true); - Assert.assertEquals(3, this.layerUnderTest.getRowCount()); + assertEquals(3, this.layerUnderTest.getRowCount()); } } diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowRegularExpressionConverterTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowRegularExpressionConverterTest.java index c802510e..5bd6d771 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowRegularExpressionConverterTest.java +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowRegularExpressionConverterTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2020 Dirk Fauth and others. + * Copyright (c) 2015, 2022 Dirk Fauth and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,10 +12,10 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.extension.glazedlists.filterrow; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.nebula.widgets.nattable.filterrow.FilterRowRegularExpressionConverter; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class FilterRowRegularExpressionConverterTest { diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowUtilsTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowUtilsTest.java index ee8716c3..5bddf426 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowUtilsTest.java +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowUtilsTest.java @@ -12,17 +12,17 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.extension.glazedlists.filterrow; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import java.util.List; import org.eclipse.nebula.widgets.nattable.filterrow.ParseResult; import org.eclipse.nebula.widgets.nattable.filterrow.ParseResult.MatchType; import org.eclipse.nebula.widgets.nattable.filterrow.TextMatchingMode; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import ca.odell.glazedlists.matchers.ThresholdMatcherEditor; @@ -45,7 +45,7 @@ public class FilterRowUtilsTest { } @Test - @Ignore + @Disabled // this one causes issues when trying to add regular expressions in the // filter itself // e.g. spaces in the custom regular expression will lead to a wrong parsed @@ -365,64 +365,34 @@ public class FilterRowUtilsTest { @Test public void shouldMatch() { - assertNull("Single character matches", getSeparatorCharacters(";")); - assertNull("Missing end bracket matches", getSeparatorCharacters("[&;")); - assertNull("Missing start bracket matches", getSeparatorCharacters("&;]")); - assertNull("Missing brackets matches", getSeparatorCharacters("&;")); - assertNull("More than 2 characters matches", getSeparatorCharacters("&;\\|")); - assertNull("Null matches", getSeparatorCharacters(null)); - assertNull("Empty matches", getSeparatorCharacters("")); - assertNull("Text matches", getSeparatorCharacters("NatTable")); - - String[] delimiterChars = getSeparatorCharacters("[&;]"); - assertNotNull("Two characters doesn't match", delimiterChars); + assertNull(FilterRowUtils.getSeparatorCharacters(";"), "Single character matches"); + assertNull(FilterRowUtils.getSeparatorCharacters("[&;"), "Missing end bracket matches"); + assertNull(FilterRowUtils.getSeparatorCharacters("&;]"), "Missing start bracket matches"); + assertNull(FilterRowUtils.getSeparatorCharacters("&;"), "Missing brackets matches"); + assertNull(FilterRowUtils.getSeparatorCharacters("&;\\|"), "More than 2 characters matches"); + assertNull(FilterRowUtils.getSeparatorCharacters(null), "Null matches"); + assertNull(FilterRowUtils.getSeparatorCharacters(""), "Empty matches"); + assertNull(FilterRowUtils.getSeparatorCharacters("NatTable"), "Text matches"); + + String[] delimiterChars = FilterRowUtils.getSeparatorCharacters("[&;]"); + assertNotNull(delimiterChars, "Two characters doesn't match"); assertEquals("&", delimiterChars[0]); assertEquals(";", delimiterChars[1]); - delimiterChars = getSeparatorCharacters(AND_OR_DELIMITER); - assertNotNull("Second character masked doesn't match", delimiterChars); + delimiterChars = FilterRowUtils.getSeparatorCharacters(AND_OR_DELIMITER); + assertNotNull(delimiterChars, "Second character masked doesn't match"); assertEquals("&", delimiterChars[0]); assertEquals("|", delimiterChars[1]); - delimiterChars = getSeparatorCharacters("[\\|&]"); - assertNotNull("First character masked doesn't match", delimiterChars); + delimiterChars = FilterRowUtils.getSeparatorCharacters("[\\|&]"); + assertNotNull(delimiterChars, "First character masked doesn't match"); assertEquals("|", delimiterChars[0]); assertEquals("&", delimiterChars[1]); - delimiterChars = getSeparatorCharacters("[\\|\\\\]"); - assertNotNull("Both characters masked don't match", delimiterChars); + delimiterChars = FilterRowUtils.getSeparatorCharacters("[\\|\\\\]"); + assertNotNull(delimiterChars, "Both characters masked don't match"); assertEquals("|", delimiterChars[0]); assertEquals("\\", delimiterChars[1]); } - - // TODO 2.1 move this method to FilterRowUtils - private String[] getSeparatorCharacters(String delimiter) { - // start with [ and end with ] - // (.){2} => e.g. ab - // (.)\\\\(.) => a\b - // \\\\(.){2} => \ab - // \\\\(.)\\\\(.) => \a\b - String twoCharacterRegex = "\\[(((.){2})|((.)\\\\(.))|(\\\\(.){2})|(\\\\(.)\\\\(.)))\\]"; - - if (delimiter != null && delimiter.matches(twoCharacterRegex)) { - String inspect = delimiter.substring(1, delimiter.length() - 1); - - // special handling if the backslash is used as delimiter for AND or - // OR - inspect = inspect.replace("\\\\", "backslash"); - - // now replace all backslashed - inspect = inspect.replaceAll("\\\\", ""); - - // convert back the "backslash" to "\" - inspect = inspect.replace("backslash", "\\"); - if (inspect.length() == 2) { - String[] result = new String[] { inspect.substring(0, 1), inspect.substring(1, 2) }; - return result; - } - } - - return null; - } } diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/fixture/BaseDataLayerFixture.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/fixture/BaseDataLayerFixture.java index 158515ec..85e593df 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/fixture/BaseDataLayerFixture.java +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/fixture/BaseDataLayerFixture.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -17,8 +17,6 @@ import java.util.Map; import org.eclipse.nebula.widgets.nattable.data.IDataProvider; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; -import org.eclipse.nebula.widgets.nattable.layer.LabelStack; -import org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelAccumulator; /** * A DataLayer for use in unit tests with a pre-canned @@ -34,10 +32,9 @@ public class BaseDataLayerFixture extends DataLayer { initCellLabelAccumulator(); } - private IDataProvider initDataProvider(final int colCount, - final int rowCount) { + private IDataProvider initDataProvider(final int colCount, final int rowCount) { return new IDataProvider() { - Map<String, Object> dataStore = new HashMap<String, Object>(); + Map<String, Object> dataStore = new HashMap<>(); @Override public int getColumnCount() { @@ -70,15 +67,7 @@ public class BaseDataLayerFixture extends DataLayer { } private void initCellLabelAccumulator() { - setConfigLabelAccumulator(new IConfigLabelAccumulator() { - - @Override - public void accumulateConfigLabels(LabelStack configLabels, - int columnPosition, int rowPosition) { - configLabels.addLabel("DEFAULT"); - } - - }); + setConfigLabelAccumulator((configLabels, columnPosition, rowPosition) -> configLabels.addLabel("DEFAULT")); } } diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupby/GroupByDataLayerSummaryRowConcurrencyTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupby/GroupByDataLayerSummaryRowConcurrencyTest.java index 1f2da292..63756a37 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupby/GroupByDataLayerSummaryRowConcurrencyTest.java +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupby/GroupByDataLayerSummaryRowConcurrencyTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2020 Dirk Fauth and others. + * Copyright (c) 2015, 2022 Dirk Fauth and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupby; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import java.util.ArrayList; import java.util.List; @@ -40,9 +40,9 @@ import org.eclipse.nebula.widgets.nattable.summaryrow.FixedSummaryRowLayer; import org.eclipse.nebula.widgets.nattable.summaryrow.SummaryRowConfigAttributes; import org.eclipse.nebula.widgets.nattable.summaryrow.SummaryRowLayer; import org.eclipse.nebula.widgets.nattable.summaryrow.SummationSummaryProvider; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import ca.odell.glazedlists.EventList; import ca.odell.glazedlists.GlazedLists; @@ -62,7 +62,7 @@ public class GroupByDataLayerSummaryRowConcurrencyTest { } } - @Before + @BeforeEach public void setup() { List<Value> values = new ArrayList<>(); values.add(new Value(1)); @@ -134,7 +134,7 @@ public class GroupByDataLayerSummaryRowConcurrencyTest { this.natTable.configure(); } - @After + @AfterEach public void tearDown() { this.natTable.doCommand(new DisposeResourcesCommand()); } diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupby/GroupByDataLayerTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupby/GroupByDataLayerTest.java index 9e7566f2..e615a46c 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupby/GroupByDataLayerTest.java +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupby/GroupByDataLayerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2020 Dirk Fauth and others. + * Copyright (c) 2014, 2022 Dirk Fauth and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupby; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.ArrayList; import java.util.Collection; @@ -46,8 +46,8 @@ import org.eclipse.nebula.widgets.nattable.sort.ISortModel; import org.eclipse.nebula.widgets.nattable.sort.SortConfigAttributes; import org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum; import org.eclipse.nebula.widgets.nattable.style.DisplayMode; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import ca.odell.glazedlists.EventList; import ca.odell.glazedlists.GlazedLists; @@ -72,7 +72,7 @@ public class GroupByDataLayerTest { // property names of the Person class String[] propertyNames = { "firstName", "lastName", "money", "gender", "married", "birthday" }; - @Before + @BeforeEach public void setup() { this.groupByModel = new GroupByModel(); EventList<Person> eventList = GlazedLists.eventList(PersonService.getFixedPersons()); @@ -157,10 +157,10 @@ public class GroupByDataLayerTest { assertEquals(20, this.dataLayer.getRowCount()); Object o = this.dataLayer.getTreeList().get(0); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Flanders", ((GroupByObject) o).getValue()); o = this.dataLayer.getTreeList().get(9); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Simpson", ((GroupByObject) o).getValue()); } @@ -205,44 +205,44 @@ public class GroupByDataLayerTest { // Flanders Object o = this.dataLayer.getTreeList().get(0); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Flanders", ((GroupByObject) o).getValue()); o = this.dataLayer.getTreeList().get(1); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Maude", ((GroupByObject) o).getValue()); o = this.dataLayer.getTreeList().get(4); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Ned", ((GroupByObject) o).getValue()); o = this.dataLayer.getTreeList().get(7); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Rodd", ((GroupByObject) o).getValue()); o = this.dataLayer.getTreeList().get(10); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Todd", ((GroupByObject) o).getValue()); // Simpsons o = this.dataLayer.getTreeList().get(13); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Simpson", ((GroupByObject) o).getValue()); o = this.dataLayer.getTreeList().get(14); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Bart", ((GroupByObject) o).getValue()); o = this.dataLayer.getTreeList().get(18); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Homer", ((GroupByObject) o).getValue()); o = this.dataLayer.getTreeList().get(22); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Lisa", ((GroupByObject) o).getValue()); o = this.dataLayer.getTreeList().get(25); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Marge", ((GroupByObject) o).getValue()); } @@ -252,11 +252,11 @@ public class GroupByDataLayerTest { for (int row = 0; row < this.dataLayer.getRowCount(); row++) { for (int column = 0; column < this.dataLayer.getColumnCount(); column++) { LabelStack stack = this.dataLayer.getConfigLabelsByPosition(column, row); - assertTrue("column label not found", stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column)); - assertFalse("groupBy object label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT)); - assertFalse("groupBy column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column)); - assertFalse("groupBy summary label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY)); - assertFalse("groupBy summary column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column)); + assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column), "column label not found"); + assertFalse(stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT), "groupBy object label found"); + assertFalse(stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column), "groupBy column label found"); + assertFalse(stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY), "groupBy summary label found"); + assertFalse(stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column), "groupBy summary column label found"); } } } @@ -269,26 +269,26 @@ public class GroupByDataLayerTest { for (int row = 0; row < this.dataLayer.getRowCount(); row++) { for (int column = 0; column < this.dataLayer.getColumnCount(); column++) { LabelStack stack = this.dataLayer.getConfigLabelsByPosition(column, row); - assertTrue("column label not found", stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column)); + assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column), "column label not found"); if (row == 0 || row == 9) { // row 0 is groupBy for flanders, row 9 groupBy for simpsons // there should be groupBy labels but no groupBySummary // labels - assertTrue("groupBy object label not found", stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT)); - assertTrue("groupBy column label not found", stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column)); + assertTrue(stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT), "groupBy object label not found"); + assertTrue(stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column), "groupBy column label not found"); // respect the label order assertEquals(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column, stack.get(0)); assertEquals(GroupByDataLayer.GROUP_BY_OBJECT, stack.get(1)); assertEquals(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column, stack.get(2)); } else { - assertFalse("groupBy object label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT)); - assertFalse("groupBy column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column)); + assertFalse(stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT), "groupBy object label found"); + assertFalse(stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column), "groupBy column label found"); } - assertFalse("groupBy summary label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY)); - assertFalse("groupBy summary column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column)); + assertFalse(stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY), "groupBy summary label found"); + assertFalse(stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column), "groupBy summary column label found"); } } } @@ -304,16 +304,16 @@ public class GroupByDataLayerTest { for (int row = 0; row < this.dataLayer.getRowCount(); row++) { for (int column = 0; column < this.dataLayer.getColumnCount(); column++) { LabelStack stack = this.dataLayer.getConfigLabelsByPosition(column, row); - assertTrue("column label not found", stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column)); + assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column), "column label not found"); if (row == 0 || row == 9) { // row 0 is groupBy for flanders, row 9 groupBy for simpsons - assertTrue("groupBy object label not found", stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT)); - assertTrue("groupBy column label not found", stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column)); + assertTrue(stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT), "groupBy object label not found"); + assertTrue(stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column), "groupBy column label not found"); if (column == 2) { - assertTrue("groupBy summary label not found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY)); - assertTrue("groupBy summary column label not found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column)); + assertTrue(stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY), "groupBy summary label not found"); + assertTrue(stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column), "groupBy summary column label not found"); // respect the label order assertEquals(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column, stack.get(0)); @@ -322,8 +322,8 @@ public class GroupByDataLayerTest { assertEquals(GroupByDataLayer.GROUP_BY_OBJECT, stack.get(3)); assertEquals(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column, stack.get(4)); } else { - assertFalse("groupBy summary label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY)); - assertFalse("groupBy summary column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column)); + assertFalse(stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY), "groupBy summary label found"); + assertFalse(stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column), "groupBy summary column label found"); // respect the label order assertEquals(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column, stack.get(0)); @@ -331,10 +331,10 @@ public class GroupByDataLayerTest { assertEquals(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column, stack.get(2)); } } else { - assertFalse("groupBy object label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT)); - assertFalse("groupBy column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column)); - assertFalse("groupBy summary label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY)); - assertFalse("groupBy summary column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column)); + assertFalse(stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT), "groupBy object label found"); + assertFalse(stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column), "groupBy column label found"); + assertFalse(stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY), "groupBy summary label found"); + assertFalse(stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column), "groupBy summary column label found"); } } } @@ -354,16 +354,16 @@ public class GroupByDataLayerTest { for (int row = 0; row < this.dataLayer.getRowCount(); row++) { for (int column = 0; column < this.dataLayer.getColumnCount(); column++) { LabelStack stack = this.dataLayer.getConfigLabelsByPosition(column, row); - assertTrue("column label not found", stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column)); + assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column), "column label not found"); if (row == 0 || row == 9) { // row 0 is groupBy for flanders, row 9 groupBy for simpsons - assertTrue("groupBy object label not found", stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT)); - assertTrue("groupBy column label not found", stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column)); + assertTrue(stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT), "groupBy object label not found"); + assertTrue(stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column), "groupBy column label not found"); if (column == 2) { - assertTrue("groupBy summary label not found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY)); - assertTrue("groupBy summary column label not found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column)); + assertTrue(stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY), "groupBy summary label not found"); + assertTrue(stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column), "groupBy summary column label not found"); // simpsons are more than flanders, so only simpsons // should have conditional formatting @@ -384,8 +384,8 @@ public class GroupByDataLayerTest { assertEquals(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column, stack.get(4)); } } else { - assertFalse("groupBy summary label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY)); - assertFalse("groupBy summary column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column)); + assertFalse(stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY), "groupBy summary label found"); + assertFalse(stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column), "groupBy summary column label found"); // respect the label order assertEquals(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column, stack.get(0)); @@ -393,10 +393,10 @@ public class GroupByDataLayerTest { assertEquals(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column, stack.get(2)); } } else { - assertFalse("groupBy object label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT)); - assertFalse("groupBy column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column)); - assertFalse("groupBy summary label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY)); - assertFalse("groupBy summary column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column)); + assertFalse(stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT), "groupBy object label found"); + assertFalse(stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column), "groupBy column label found"); + assertFalse(stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY), "groupBy summary label found"); + assertFalse(stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column), "groupBy summary column label found"); } } } @@ -412,42 +412,42 @@ public class GroupByDataLayerTest { assertEquals(20, this.dataLayer.getRowCount()); Object o = this.dataLayer.getTreeList().get(0); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Flanders", ((GroupByObject) o).getValue()); o = this.dataLayer.getTreeList().get(9); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Simpson", ((GroupByObject) o).getValue()); // unsorted leafs, first leaf in Simpson is Homer o = this.dataLayer.getTreeList().get(10); - assertTrue("Object is not a Person", o instanceof Person); + assertTrue(o instanceof Person, "Object is not a Person"); assertEquals("Homer", ((Person) o).getFirstName()); // sort ascending this.sortModel.sort(0, SortDirectionEnum.ASC, false); o = this.dataLayer.getTreeList().get(0); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Flanders", ((GroupByObject) o).getValue()); o = this.dataLayer.getTreeList().get(9); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Simpson", ((GroupByObject) o).getValue()); // ascending sorted leafs, first leaf in Simpson is Bart o = this.dataLayer.getTreeList().get(10); - assertTrue("Object is not a Person", o instanceof Person); + assertTrue(o instanceof Person, "Object is not a Person"); assertEquals("Bart", ((Person) o).getFirstName()); // sort descending this.sortModel.sort(0, SortDirectionEnum.DESC, false); o = this.dataLayer.getTreeList().get(0); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Simpson", ((GroupByObject) o).getValue()); o = this.dataLayer.getTreeList().get(11); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Flanders", ((GroupByObject) o).getValue()); // descending sorted leafs, first leaf in Flanders is Todd o = this.dataLayer.getTreeList().get(12); - assertTrue("Object is not a Person", o instanceof Person); + assertTrue(o instanceof Person, "Object is not a Person"); assertEquals("Todd", ((Person) o).getFirstName()); } @@ -461,31 +461,31 @@ public class GroupByDataLayerTest { assertEquals(20, this.dataLayer.getRowCount()); Object o = this.dataLayer.getTreeList().get(0); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Flanders", ((GroupByObject) o).getValue()); o = this.dataLayer.getTreeList().get(9); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Simpson", ((GroupByObject) o).getValue()); // unsorted leafs, Maude is on position 3 within Flanders o = this.dataLayer.getTreeList().get(3); - assertTrue("Object is not a Person", o instanceof Person); + assertTrue(o instanceof Person, "Object is not a Person"); assertEquals("Maude", ((Person) o).getFirstName()); // sort ascending by gender this.sortModel.sort(3, SortDirectionEnum.ASC, false); o = this.dataLayer.getTreeList().get(0); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Flanders", ((GroupByObject) o).getValue()); o = this.dataLayer.getTreeList().get(9); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Simpson", ((GroupByObject) o).getValue()); // ascending sorted leafs, Maude should be on last position within // Flanders o = this.dataLayer.getTreeList().get(8); - assertTrue("Object is not a Person", o instanceof Person); + assertTrue(o instanceof Person, "Object is not a Person"); assertEquals("Maude", ((Person) o).getFirstName()); // sort descending by gender @@ -494,16 +494,16 @@ public class GroupByDataLayerTest { // no changes to tree o = this.dataLayer.getTreeList().get(0); o = this.dataLayer.getTreeList().get(0); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Flanders", ((GroupByObject) o).getValue()); o = this.dataLayer.getTreeList().get(9); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Simpson", ((GroupByObject) o).getValue()); // descending sorted leafs, Maude should be on first position within // Flanders o = this.dataLayer.getTreeList().get(1); - assertTrue("Object is not a Person", o instanceof Person); + assertTrue(o instanceof Person, "Object is not a Person"); assertEquals("Maude", ((Person) o).getFirstName()); } @@ -528,19 +528,19 @@ public class GroupByDataLayerTest { assertEquals(20, this.dataLayer.getRowCount()); Object o = this.dataLayer.getTreeList().get(0); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Flanders", ((GroupByObject) o).getValue()); LabelStack labelStack = this.dataLayer.getConfigLabelsByPosition(2, 0); assertEquals(2800.0d, this.dataLayer.getDataValueByPosition(2, 0, labelStack, false)); o = this.dataLayer.getTreeList().get(1); - assertTrue("Object is not a Person", o instanceof Person); + assertTrue(o instanceof Person, "Object is not a Person"); assertEquals("Ned", ((Person) o).getFirstName()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, 1); assertEquals(500.0d, this.dataLayer.getDataValueByPosition(2, 1, labelStack, false)); o = this.dataLayer.getTreeList().get(9); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Simpson", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, 9); assertEquals(1000.0d, this.dataLayer.getDataValueByPosition(2, 9, labelStack, false)); @@ -549,19 +549,19 @@ public class GroupByDataLayerTest { this.sortModel.sort(2, SortDirectionEnum.ASC, false); o = this.dataLayer.getTreeList().get(0); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Simpson", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, 0); assertEquals(1000.0d, this.dataLayer.getDataValueByPosition(2, 0, labelStack, false)); o = this.dataLayer.getTreeList().get(11); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Flanders", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, 11); assertEquals(2800.0d, this.dataLayer.getDataValueByPosition(2, 11, labelStack, false)); o = this.dataLayer.getTreeList().get(12); - assertTrue("Object is not a Person", o instanceof Person); + assertTrue(o instanceof Person, "Object is not a Person"); assertEquals("Todd", ((Person) o).getFirstName()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, 1); assertEquals(100.0d, this.dataLayer.getDataValueByPosition(2, 1, labelStack, false)); @@ -570,19 +570,19 @@ public class GroupByDataLayerTest { this.sortModel.sort(2, SortDirectionEnum.DESC, false); o = this.dataLayer.getTreeList().get(0); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Flanders", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, 0); assertEquals(2800.0d, this.dataLayer.getDataValueByPosition(2, 0, labelStack, false)); o = this.dataLayer.getTreeList().get(9); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Simpson", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, 9); assertEquals(1000.0d, this.dataLayer.getDataValueByPosition(2, 9, labelStack, false)); o = this.dataLayer.getTreeList().get(1); - assertTrue("Object is not a Person", o instanceof Person); + assertTrue(o instanceof Person, "Object is not a Person"); assertEquals("Ned", ((Person) o).getFirstName()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, 1); assertEquals(500.0d, this.dataLayer.getDataValueByPosition(2, 1, labelStack, false)); @@ -613,35 +613,35 @@ public class GroupByDataLayerTest { // Flanders int row = 0; Object o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Flanders", ((GroupByObject) o).getValue()); LabelStack labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(2800.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 1; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Maude", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(800.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 4; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Ned", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(1000.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 7; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Rodd", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(600.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 10; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Todd", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(400.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); @@ -649,35 +649,35 @@ public class GroupByDataLayerTest { // Simpsons row = 13; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Simpson", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(1000.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 14; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Bart", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(300.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 18; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Homer", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(300.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 22; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Lisa", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(200.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 25; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Marge", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(200.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); @@ -688,35 +688,35 @@ public class GroupByDataLayerTest { // Simpsons row = 0; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Simpson", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(1000.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 1; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Lisa", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(200.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 4; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Marge", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(200.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 7; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Bart", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(300.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 11; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Homer", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(300.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); @@ -724,35 +724,35 @@ public class GroupByDataLayerTest { // Flanders row = 15; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Flanders", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(2800.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 16; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Todd", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(400.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 19; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Rodd", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(600.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 22; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Maude", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(800.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 25; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Ned", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(1000.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); @@ -763,35 +763,35 @@ public class GroupByDataLayerTest { // Flanders row = 0; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Flanders", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(2800.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 1; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Ned", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(1000.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 4; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Maude", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(800.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 7; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Rodd", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(600.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 10; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Todd", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(400.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); @@ -799,35 +799,35 @@ public class GroupByDataLayerTest { // Simpsons row = 13; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Simpson", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(1000.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 14; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Homer", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(300.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 18; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Bart", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(300.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 22; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Marge", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(200.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); row = 25; o = this.dataLayer.getTreeList().get(row); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Lisa", ((GroupByObject) o).getValue()); labelStack = this.dataLayer.getConfigLabelsByPosition(2, row); assertEquals(200.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false)); @@ -884,51 +884,51 @@ public class GroupByDataLayerTest { assertEquals(26, this.dataLayer.getRowCount()); Object o = this.dataLayer.getTreeList().get(0); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Bart", ((GroupByObject) o).getValue()); assertEquals("Simpson", this.dataLayer.getDataValue(1, 1)); assertEquals("Simpson", this.dataLayer.getDataValue(1, 2)); assertEquals("Simpson", this.dataLayer.getDataValue(1, 3)); o = this.dataLayer.getTreeList().get(4); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Homer", ((GroupByObject) o).getValue()); assertEquals("Simpson", this.dataLayer.getDataValue(1, 5)); assertEquals("Simpson", this.dataLayer.getDataValue(1, 6)); assertEquals("Simpson", this.dataLayer.getDataValue(1, 7)); o = this.dataLayer.getTreeList().get(8); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Lisa", ((GroupByObject) o).getValue()); assertEquals("Simpson", this.dataLayer.getDataValue(1, 9)); assertEquals("Simpson", this.dataLayer.getDataValue(1, 10)); o = this.dataLayer.getTreeList().get(11); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Marge", ((GroupByObject) o).getValue()); assertEquals("Simpson", this.dataLayer.getDataValue(1, 12)); assertEquals("Simpson", this.dataLayer.getDataValue(1, 13)); o = this.dataLayer.getTreeList().get(14); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Maude", ((GroupByObject) o).getValue()); assertEquals("Flanders", this.dataLayer.getDataValue(1, 15)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 16)); o = this.dataLayer.getTreeList().get(17); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Ned", ((GroupByObject) o).getValue()); assertEquals("Flanders", this.dataLayer.getDataValue(1, 18)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 19)); o = this.dataLayer.getTreeList().get(20); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Rodd", ((GroupByObject) o).getValue()); assertEquals("Flanders", this.dataLayer.getDataValue(1, 21)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 22)); o = this.dataLayer.getTreeList().get(23); - assertTrue("Object is not a GroupByObject", o instanceof GroupByObject); + assertTrue(o instanceof GroupByObject, "Object is not a GroupByObject"); assertEquals("Todd", ((GroupByObject) o).getValue()); assertEquals("Flanders", this.dataLayer.getDataValue(1, 24)); assertEquals("Flanders", this.dataLayer.getDataValue(1, 25)); diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupby/GroupByModelPersistenceTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupby/GroupByModelPersistenceTest.java index 5a8d1db8..d57323bf 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupby/GroupByModelPersistenceTest.java +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupby/GroupByModelPersistenceTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2020 Dirk Fauth and others. + * Copyright (c) 2013, 2022 Dirk Fauth and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,25 +12,21 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupby; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; import java.util.Properties; import org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByModel; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -/** - * @author Dirk Fauth - * - */ public class GroupByModelPersistenceTest { private GroupByModel model; - @Before + @BeforeEach public void setup() { this.model = new GroupByModel(); } @@ -80,7 +76,7 @@ public class GroupByModelPersistenceTest { this.model.removeGroupByColumnIndex(5); this.model.removeGroupByColumnIndex(9); - assertTrue("indexes are not empty", this.model.getGroupByColumnIndexes().isEmpty()); + assertTrue(this.model.getGroupByColumnIndexes().isEmpty(), "indexes are not empty"); this.model.saveState("prefix", properties); diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/hierarchical/HierarchicalTreeLayerGlazedListsTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/hierarchical/HierarchicalTreeLayerGlazedListsTest.java index 52c102ba..eec1c7ca 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/hierarchical/HierarchicalTreeLayerGlazedListsTest.java +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/hierarchical/HierarchicalTreeLayerGlazedListsTest.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2018, 2020 Dirk Fauth. + * Copyright (c) 2018, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -13,9 +13,9 @@ *****************************************************************************/ package org.eclipse.nebula.widgets.nattable.extension.glazedlists.hierarchical; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import java.util.Arrays; import java.util.Date; @@ -51,9 +51,9 @@ import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; import org.eclipse.nebula.widgets.nattable.sort.SortConfigAttributes; import org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum; import org.eclipse.nebula.widgets.nattable.tree.command.TreeExpandCollapseCommand; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import ca.odell.glazedlists.EventList; import ca.odell.glazedlists.FilterList; @@ -79,7 +79,7 @@ public class HierarchicalTreeLayerGlazedListsTest { private HierarchicalWrapperSortModel sortModel; - @Before + @BeforeEach public void setup() { this.input = CarService.getInput(); // de-normalize the object graph without parent structure objects @@ -123,7 +123,7 @@ public class HierarchicalTreeLayerGlazedListsTest { this.sortedList, this.columnPropertyAccessor, this.treeLayer.getLevelIndexMapping(), this.columnHeaderDataLayer, this.configRegistry); } - @After + @AfterEach public void tearDown() { this.treeLayer.doCommand(new DisposeResourcesCommand()); } diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/BodyLayerStackFixture.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/BodyLayerStackFixture.java index ebe88e4b..128d4b13 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/BodyLayerStackFixture.java +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/BodyLayerStackFixture.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -24,7 +24,6 @@ import org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer; import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; -import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; import ca.odell.glazedlists.EventList; @@ -65,11 +64,6 @@ public class BodyLayerStackFixture<T> extends AbstractLayerTransform { setUnderlyingLayer(this.viewportLayer); } - @Override - public void setClientAreaProvider(IClientAreaProvider clientAreaProvider) { - super.setClientAreaProvider(clientAreaProvider); - } - public ColumnReorderLayer getColumnReorderLayer() { return this.columnReorderLayer; } diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/DataChangeLayerIntegrationTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/DataChangeLayerIntegrationTest.java index 3bd0d37f..b9955b00 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/DataChangeLayerIntegrationTest.java +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/DataChangeLayerIntegrationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2020 Dirk Fauth. + * Copyright (c) 2018, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,9 +12,9 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.extension.glazedlists.test.integration; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.Serializable; import java.util.List; @@ -36,9 +36,9 @@ import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.layer.ILayerListener; import org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent; import org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralRefreshEvent; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import ca.odell.glazedlists.EventList; import ca.odell.glazedlists.FilterList; @@ -56,7 +56,7 @@ public class DataChangeLayerIntegrationTest { private CountDownLatch lock = new CountDownLatch(1); - @Before + @BeforeEach public void setup() { this.dataModel = PersonService.getFixedPersons(); EventList<Person> eventList = GlazedLists.eventList(this.dataModel); @@ -101,7 +101,7 @@ public class DataChangeLayerIntegrationTest { } - @After + @AfterEach public void tearDown() { this.dataChangeLayer.doCommand(new DisposeResourcesCommand()); } @@ -114,10 +114,10 @@ public class DataChangeLayerIntegrationTest { assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 1)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(1)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(1), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); } @Test @@ -136,11 +136,11 @@ public class DataChangeLayerIntegrationTest { // RowStructuralRefreshEvent boolean completed = this.lock.await(1000, TimeUnit.MILLISECONDS); - assertTrue("Timeout - no event received", completed); + assertTrue(completed, "Timeout - no event received"); assertEquals(9, this.filterList.size()); assertFalse(this.dataChangeLayer.getDataChanges().isEmpty()); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); this.lock = new CountDownLatch(1); this.filterList.setMatcher(null); @@ -149,11 +149,11 @@ public class DataChangeLayerIntegrationTest { // RowStructuralRefreshEvent completed = this.lock.await(1000, TimeUnit.MILLISECONDS); - assertTrue("Timeout - no event received", completed); + assertTrue(completed, "Timeout - no event received"); assertEquals(18, this.filterList.size()); assertFalse(this.dataChangeLayer.getDataChanges().isEmpty()); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); } @Test @@ -172,7 +172,7 @@ public class DataChangeLayerIntegrationTest { assertEquals(9, this.filterList.size()); assertFalse(this.dataChangeLayer.getDataChanges().isEmpty()); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); this.filterList.setMatcher(null); @@ -180,10 +180,10 @@ public class DataChangeLayerIntegrationTest { // RowStructuralRefreshEvent boolean completed = this.lock.await(1000, TimeUnit.MILLISECONDS); - assertTrue("Timeout - no event received", completed); + assertTrue(completed, "Timeout - no event received"); assertEquals(18, this.filterList.size()); assertFalse(this.dataChangeLayer.getDataChanges().isEmpty()); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); } } diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/HideMultipleColumnsIntegrationTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/HideMultipleColumnsIntegrationTest.java index 6be3f67c..3e691e1b 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/HideMultipleColumnsIntegrationTest.java +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/HideMultipleColumnsIntegrationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.extension.glazedlists.test.integration; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import org.eclipse.nebula.widgets.nattable.command.DisposeResourcesCommand; import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry; @@ -27,9 +27,9 @@ import org.eclipse.nebula.widgets.nattable.hideshow.event.HideColumnPositionsEve import org.eclipse.nebula.widgets.nattable.layer.NoScalingDpiConverter; import org.eclipse.nebula.widgets.nattable.layer.command.ConfigureScalingCommand; import org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import ca.odell.glazedlists.GlazedLists; @@ -39,7 +39,7 @@ public class HideMultipleColumnsIntegrationTest { NatTableFixture natTableFixture; LayerListenerFixture listenerFixture; - @Before + @BeforeEach public void setup() { this.bodyLayerStackFixture = new BodyLayerStackFixture<>( GlazedLists.eventList(RowDataListFixture.getList()), @@ -73,7 +73,7 @@ public class HideMultipleColumnsIntegrationTest { this.natTableFixture.doCommand(new DisposeResourcesCommand()); } - @After + @AfterEach public void tearDown() { this.natTableFixture.doCommand(new DisposeResourcesCommand()); } diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/RowSelectionIntegrationTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/RowSelectionIntegrationTest.java index dae01d46..0fc5eefd 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/RowSelectionIntegrationTest.java +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/RowSelectionIntegrationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,8 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.extension.glazedlists.test.integration; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; import java.io.Serializable; import java.util.ArrayList; @@ -47,10 +47,9 @@ import org.eclipse.nebula.widgets.nattable.selection.event.CellSelectionEvent; import org.eclipse.nebula.widgets.nattable.sort.command.SortColumnCommand; import org.eclipse.nebula.widgets.nattable.sort.config.DefaultSortConfiguration; import org.eclipse.nebula.widgets.nattable.util.ArrayUtil; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import ca.odell.glazedlists.EventList; import ca.odell.glazedlists.GlazedLists; @@ -63,7 +62,7 @@ public class RowSelectionIntegrationTest { private SelectionLayer selectionLayer; private RowSelectionProvider<RowDataFixture> selectionProvider; - @Before + @BeforeEach public void setup() { IConfigRegistry configRegistry = new ConfigRegistry(); @@ -105,7 +104,7 @@ public class RowSelectionIntegrationTest { this.nattable.configure(); } - @After + @AfterEach public void tearDown() { this.nattable.doCommand(new DisposeResourcesCommand()); } @@ -164,29 +163,29 @@ public class RowSelectionIntegrationTest { this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 1, 0, false, true)); Collection<PositionCoordinate> cells = ArrayUtil.asCollection(this.selectionLayer.getSelectedCellPositions()); - Assert.assertEquals(this.selectionLayer.getColumnCount(), cells.size()); - Assert.assertEquals(1, this.selectionLayer.getSelectedRowCount()); + assertEquals(this.selectionLayer.getColumnCount(), cells.size()); + assertEquals(1, this.selectionLayer.getSelectedRowCount()); // select another cell with control mask this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 2, 1, false, true)); cells = ArrayUtil.asCollection(this.selectionLayer.getSelectedCellPositions()); - Assert.assertEquals(this.selectionLayer.getColumnCount(), cells.size()); - Assert.assertEquals(1, this.selectionLayer.getSelectedRowCount()); + assertEquals(this.selectionLayer.getColumnCount(), cells.size()); + assertEquals(1, this.selectionLayer.getSelectedRowCount()); // select additional cells with shift mask this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 2, 10, true, false)); cells = ArrayUtil.asCollection(this.selectionLayer.getSelectedCellPositions()); - Assert.assertEquals(this.selectionLayer.getColumnCount(), cells.size()); - Assert.assertEquals(1, this.selectionLayer.getSelectedRowCount()); + assertEquals(this.selectionLayer.getColumnCount(), cells.size()); + assertEquals(1, this.selectionLayer.getSelectedRowCount()); // select additional cells with shift mask this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 10, 0, true, false)); cells = ArrayUtil.asCollection(this.selectionLayer.getSelectedCellPositions()); - Assert.assertEquals(this.selectionLayer.getColumnCount(), cells.size()); - Assert.assertEquals(1, this.selectionLayer.getSelectedRowCount()); + assertEquals(this.selectionLayer.getColumnCount(), cells.size()); + assertEquals(1, this.selectionLayer.getSelectedRowCount()); } @Test diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/RowStructuralDataChangeLayerIntegrationTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/RowStructuralDataChangeLayerIntegrationTest.java index 66532382..c43ee245 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/RowStructuralDataChangeLayerIntegrationTest.java +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/RowStructuralDataChangeLayerIntegrationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2020 Dirk Fauth. + * Copyright (c) 2018, 2022 Dirk Fauth. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,12 +12,11 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.extension.glazedlists.test.integration; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; -import java.io.Serializable; import java.util.Comparator; import java.util.Date; import java.util.List; @@ -47,18 +46,15 @@ import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService; import org.eclipse.nebula.widgets.nattable.edit.command.UpdateDataCommand; import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; -import org.eclipse.nebula.widgets.nattable.layer.ILayerListener; -import org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent; import org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralRefreshEvent; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import ca.odell.glazedlists.EventList; import ca.odell.glazedlists.FilterList; import ca.odell.glazedlists.GlazedLists; import ca.odell.glazedlists.SortedList; -import ca.odell.glazedlists.matchers.Matcher; @SuppressWarnings("unchecked") public class RowStructuralDataChangeLayerIntegrationTest { @@ -75,7 +71,7 @@ public class RowStructuralDataChangeLayerIntegrationTest { private CountDownLatch lock = new CountDownLatch(1); - @Before + @BeforeEach public void setup() { this.dataModel = PersonService.getFixedPersons(); this.eventList = GlazedLists.eventList(this.dataModel); @@ -89,13 +85,7 @@ public class RowStructuralDataChangeLayerIntegrationTest { "married", "birthday" }); - IRowIdAccessor<Person> rowIdAccessor = new IRowIdAccessor<Person>() { - - @Override - public Serializable getRowId(Person rowObject) { - return rowObject.getId(); - } - }; + IRowIdAccessor<Person> rowIdAccessor = Person::getId; this.dataProvider = new ListDataProvider<>( this.filterList, @@ -130,13 +120,9 @@ public class RowStructuralDataChangeLayerIntegrationTest { // enable tracking of row structural changes true); - this.dataChangeLayer.addLayerListener(new ILayerListener() { - - @Override - public void handleLayerEvent(ILayerEvent event) { - if (event instanceof RowStructuralRefreshEvent) { - RowStructuralDataChangeLayerIntegrationTest.this.lock.countDown(); - } + this.dataChangeLayer.addLayerListener(event -> { + if (event instanceof RowStructuralRefreshEvent) { + RowStructuralDataChangeLayerIntegrationTest.this.lock.countDown(); } }); @@ -147,12 +133,12 @@ public class RowStructuralDataChangeLayerIntegrationTest { this.deleteHandler = (RowDeleteDataChangeHandler) h; } } - assertNotNull("RowInsertDataChangeHandler not found", this.insertHandler); - assertNotNull("RowDeleteDataChangeHandler not found", this.deleteHandler); + assertNotNull(this.insertHandler, "RowInsertDataChangeHandler not found"); + assertNotNull(this.deleteHandler, "RowDeleteDataChangeHandler not found"); } - @After + @AfterEach public void tearDown() { this.dataChangeLayer.doCommand(new DisposeResourcesCommand()); } @@ -165,10 +151,10 @@ public class RowStructuralDataChangeLayerIntegrationTest { assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 1)); assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 1)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(1)); - assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 1)); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(1), "Row 1 is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, 1), "Cell is not dirty"); } @Test @@ -182,25 +168,25 @@ public class RowStructuralDataChangeLayerIntegrationTest { assertEquals(19, this.eventList.size()); // row added so all columns are actually dirty - assertTrue("Column 0 is not dirty", this.dataChangeLayer.isColumnDirty(0)); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); - assertTrue("Column 2 is not dirty", this.dataChangeLayer.isColumnDirty(2)); - assertTrue("Column 3 is not dirty", this.dataChangeLayer.isColumnDirty(3)); - assertTrue("Column 4 is not dirty", this.dataChangeLayer.isColumnDirty(4)); - - assertTrue("Row " + ralphIndex + " is not dirty", this.dataChangeLayer.isRowDirty(ralphIndex)); - - assertTrue("Cell 0/" + ralphIndex + " is not dirty", this.dataChangeLayer.isCellDirty(0, ralphIndex)); - assertTrue("Cell 1/" + ralphIndex + " is not dirty", this.dataChangeLayer.isCellDirty(1, ralphIndex)); - assertTrue("Cell 2/" + ralphIndex + " is not dirty", this.dataChangeLayer.isCellDirty(2, ralphIndex)); - assertTrue("Cell 3/" + ralphIndex + " is not dirty", this.dataChangeLayer.isCellDirty(3, ralphIndex)); - assertTrue("Cell 4/" + ralphIndex + " is not dirty", this.dataChangeLayer.isCellDirty(4, ralphIndex)); - - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(2, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(3, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(4, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); + assertTrue(this.dataChangeLayer.isColumnDirty(0), "Column 0 is not dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(2), "Column 2 is not dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(3), "Column 3 is not dirty"); + assertTrue(this.dataChangeLayer.isColumnDirty(4), "Column 4 is not dirty"); + + assertTrue(this.dataChangeLayer.isRowDirty(ralphIndex), "Row " + ralphIndex + " is not dirty"); + + assertTrue(this.dataChangeLayer.isCellDirty(0, ralphIndex), "Cell 0/" + ralphIndex + " is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(1, ralphIndex), "Cell 1/" + ralphIndex + " is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(2, ralphIndex), "Cell 2/" + ralphIndex + " is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(3, ralphIndex), "Cell 3/" + ralphIndex + " is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(4, ralphIndex), "Cell 4/" + ralphIndex + " is not dirty"); + + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(1, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(2, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(3, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(4, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); assertEquals(1, this.dataChangeLayer.getDataChanges().size()); assertEquals(1, this.insertHandler.getDataChanges().size()); @@ -227,10 +213,10 @@ public class RowStructuralDataChangeLayerIntegrationTest { Object key = this.insertHandler.getKeyHandler().getKey(-1, ralphIndex); assertEquals(0, ralphIndex); - assertTrue("Column 0 is not dirty", this.dataChangeLayer.isColumnDirty(0)); - assertTrue("Row " + ralphIndex + " is not dirty", this.dataChangeLayer.isRowDirty(ralphIndex)); - assertTrue("Cell 0/" + ralphIndex + " is not dirty", this.dataChangeLayer.isCellDirty(0, ralphIndex)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); + assertTrue(this.dataChangeLayer.isColumnDirty(0), "Column 0 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(ralphIndex), "Row " + ralphIndex + " is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(0, ralphIndex), "Cell 0/" + ralphIndex + " is not dirty"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); assertEquals(1, this.dataChangeLayer.getDataChanges().size()); assertEquals(1, this.insertHandler.getDataChanges().size()); @@ -258,10 +244,10 @@ public class RowStructuralDataChangeLayerIntegrationTest { Object key = this.insertHandler.getKeyHandler().getKey(-1, ralphIndex); assertEquals(0, ralphIndex); - assertTrue("Column 0 is not dirty", this.dataChangeLayer.isColumnDirty(0)); - assertTrue("Row " + ralphIndex + " is not dirty", this.dataChangeLayer.isRowDirty(ralphIndex)); - assertTrue("Cell 0/" + ralphIndex + " is not dirty", this.dataChangeLayer.isCellDirty(0, ralphIndex)); - assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY)); + assertTrue(this.dataChangeLayer.isColumnDirty(0), "Column 0 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(ralphIndex), "Row " + ralphIndex + " is not dirty"); + assertTrue(this.dataChangeLayer.isCellDirty(0, ralphIndex), "Cell 0/" + ralphIndex + " is not dirty"); + assertTrue(this.dataChangeLayer.getConfigLabelsByPosition(0, ralphIndex).hasLabel(DataChangeLayer.DIRTY), "Dirty label not set"); assertEquals(1, this.dataChangeLayer.getDataChanges().size()); assertEquals(1, this.insertHandler.getDataChanges().size()); @@ -295,12 +281,12 @@ public class RowStructuralDataChangeLayerIntegrationTest { assertTrue(this.insertHandler.getDataChanges().isEmpty()); // check for states on row 0 - assertFalse("Column 0 is dirty", this.dataChangeLayer.isColumnDirty(0)); - assertFalse("Row 0 is dirty", this.dataChangeLayer.isRowDirty(0)); - assertFalse("Cell 0/0 is dirty", this.dataChangeLayer.isCellDirty(0, 0)); - assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(0, 0).hasLabel(DataChangeLayer.DIRTY)); + assertFalse(this.dataChangeLayer.isColumnDirty(0), "Column 0 is dirty"); + assertFalse(this.dataChangeLayer.isRowDirty(0), "Row 0 is dirty"); + assertFalse(this.dataChangeLayer.isCellDirty(0, 0), "Cell 0/0 is dirty"); + assertFalse(this.dataChangeLayer.getConfigLabelsByPosition(0, 0).hasLabel(DataChangeLayer.DIRTY), "Dirty label set"); - assertFalse("Ralph is still here", this.sortedList.contains(ralph)); + assertFalse(this.sortedList.contains(ralph), "Ralph is still here"); } @Test @@ -330,10 +316,10 @@ public class RowStructuralDataChangeLayerIntegrationTest { // check that no row is dirty for (int row = 0; row < this.sortedList.size(); row++) { - assertFalse("Row " + row + " is dirty", this.dataChangeLayer.isRowDirty(row)); + assertFalse(this.dataChangeLayer.isRowDirty(row), "Row " + row + " is dirty"); } - assertFalse("Ralph is still here", this.sortedList.contains(ralph)); + assertFalse(this.sortedList.contains(ralph), "Ralph is still here"); } @Test @@ -359,9 +345,9 @@ public class RowStructuralDataChangeLayerIntegrationTest { assertEquals(19, this.sortedList.indexOf(sarah)); assertEquals(20, this.sortedList.indexOf(ralph)); - assertTrue("Row 18 is not dirty", this.dataChangeLayer.isRowDirty(18)); - assertTrue("Row 19 is not dirty", this.dataChangeLayer.isRowDirty(19)); - assertTrue("Row 20 is not dirty", this.dataChangeLayer.isRowDirty(20)); + assertTrue(this.dataChangeLayer.isRowDirty(18), "Row 18 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(19), "Row 19 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(20), "Row 20 is not dirty"); // discard the change this.dataChangeLayer.doCommand(new DiscardDataChangesCommand()); @@ -373,12 +359,12 @@ public class RowStructuralDataChangeLayerIntegrationTest { // check that no row is dirty for (int row = 0; row < this.sortedList.size(); row++) { - assertFalse("Row " + row + " is dirty", this.dataChangeLayer.isRowDirty(row)); + assertFalse(this.dataChangeLayer.isRowDirty(row), "Row " + row + " is dirty"); } - assertFalse("Clancy is still here", this.sortedList.contains(clancy)); - assertFalse("Sarah is still here", this.sortedList.contains(sarah)); - assertFalse("Ralph is still here", this.sortedList.contains(ralph)); + assertFalse(this.sortedList.contains(clancy), "Clancy is still here"); + assertFalse(this.sortedList.contains(sarah), "Sarah is still here"); + assertFalse(this.sortedList.contains(ralph), "Ralph is still here"); } @Test @@ -404,9 +390,9 @@ public class RowStructuralDataChangeLayerIntegrationTest { assertEquals(11, this.sortedList.indexOf(sarah)); assertEquals(12, this.sortedList.indexOf(ralph)); - assertTrue("Row 10 is not dirty", this.dataChangeLayer.isRowDirty(10)); - assertTrue("Row 11 is not dirty", this.dataChangeLayer.isRowDirty(11)); - assertTrue("Row 12 is not dirty", this.dataChangeLayer.isRowDirty(12)); + assertTrue(this.dataChangeLayer.isRowDirty(10), "Row 10 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(11), "Row 11 is not dirty"); + assertTrue(this.dataChangeLayer.isRowDirty(12), "Row 12 is not dirty"); // discard the change this.dataChangeLayer.doCommand(new DiscardDataChangesCommand()); @@ -418,35 +404,29 @@ public class RowStructuralDataChangeLayerIntegrationTest { // check that no row is dirty for (int row = 0; row < this.sortedList.size(); row++) { - assertFalse("Row " + row + " is dirty", this.dataChangeLayer.isRowDirty(row)); + assertFalse(this.dataChangeLayer.isRowDirty(row), "Row " + row + " is dirty"); } - assertFalse("Clancy is still here", this.sortedList.contains(clancy)); - assertFalse("Sarah is still here", this.sortedList.contains(sarah)); - assertFalse("Ralph is still here", this.sortedList.contains(ralph)); + assertFalse(this.sortedList.contains(clancy), "Clancy is still here"); + assertFalse(this.sortedList.contains(sarah), "Sarah is still here"); + assertFalse(this.sortedList.contains(ralph), "Ralph is still here"); } @Test public void shouldKeepChangeOnFilter() throws InterruptedException { this.dataChangeLayer.doCommand(new UpdateDataCommand(this.dataChangeLayer, 1, 1, "Lovejoy")); - this.filterList.setMatcher(new Matcher<Person>() { - - @Override - public boolean matches(Person item) { - return item.getLastName().equals("Simpson"); - } - }); + this.filterList.setMatcher(item -> item.getLastName().equals("Simpson")); // give the GlazedListsEventLayer some time to trigger the // RowStructuralRefreshEvent boolean completed = this.lock.await(1000, TimeUnit.MILLISECONDS); - assertTrue("Timeout - no event received", completed); + assertTrue(completed, "Timeout - no event received"); assertEquals(9, this.filterList.size()); assertFalse(this.dataChangeLayer.getDataChanges().isEmpty()); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); this.lock = new CountDownLatch(1); this.filterList.setMatcher(null); @@ -455,30 +435,24 @@ public class RowStructuralDataChangeLayerIntegrationTest { // RowStructuralRefreshEvent completed = this.lock.await(1000, TimeUnit.MILLISECONDS); - assertTrue("Timeout - no event received", completed); + assertTrue(completed, "Timeout - no event received"); assertEquals(18, this.filterList.size()); assertFalse(this.dataChangeLayer.getDataChanges().isEmpty()); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); } @Test public void shouldNotThrowAnExceptionOnResize() throws InterruptedException { this.dataChangeLayer.doCommand(new UpdateDataCommand(this.dataChangeLayer, 1, 1, "Lovejoy")); - this.filterList.setMatcher(new Matcher<Person>() { - - @Override - public boolean matches(Person item) { - return item.getLastName().equals("Simpson"); - } - }); + this.filterList.setMatcher(item -> item.getLastName().equals("Simpson")); this.dataLayer.setColumnWidthByPosition(2, 75); assertEquals(9, this.filterList.size()); assertFalse(this.dataChangeLayer.getDataChanges().isEmpty()); - assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1)); + assertFalse(this.dataChangeLayer.isColumnDirty(1), "Column 1 is dirty"); this.filterList.setMatcher(null); @@ -486,10 +460,10 @@ public class RowStructuralDataChangeLayerIntegrationTest { // RowStructuralRefreshEvent boolean completed = this.lock.await(1000, TimeUnit.MILLISECONDS); - assertTrue("Timeout - no event received", completed); + assertTrue(completed, "Timeout - no event received"); assertEquals(18, this.filterList.size()); assertFalse(this.dataChangeLayer.getDataChanges().isEmpty()); - assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1)); + assertTrue(this.dataChangeLayer.isColumnDirty(1), "Column 1 is not dirty"); } } diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/SortIntegrationTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/SortIntegrationTest.java index 1daef870..444f57be 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/SortIntegrationTest.java +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/SortIntegrationTest.java @@ -12,10 +12,10 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.extension.glazedlists.test.integration; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Comparator; import java.util.List; @@ -38,9 +38,9 @@ import org.eclipse.nebula.widgets.nattable.sort.command.SortColumnCommand; import org.eclipse.nebula.widgets.nattable.sort.config.DefaultSortConfiguration; import org.eclipse.nebula.widgets.nattable.style.DisplayMode; import org.eclipse.swt.SWT; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import ca.odell.glazedlists.EventList; import ca.odell.glazedlists.GlazedLists; @@ -51,7 +51,7 @@ public class SortIntegrationTest { private NatTableFixture nattable; private GlazedListsGridLayer<RowDataFixture> gridLayerStack; - @Before + @BeforeEach public void setup() { EventList<RowDataFixture> eventList = GlazedLists.eventList(RowDataListFixture.getList().subList(0, 4)); @@ -72,7 +72,7 @@ public class SortIntegrationTest { this.nattable.doCommand(new ConfigureScalingCommand(new NoScalingDpiConverter())); } - @After + @AfterEach public void tearDown() { this.nattable.doCommand(new DisposeResourcesCommand()); } @@ -206,11 +206,11 @@ public class SortIntegrationTest { @Test public void shouldSortColumnByCommand() { ISortModel sortModel = this.gridLayerStack.getSortHeaderLayer().getSortModel(); - assertTrue("Sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertTrue(sortModel.getSortedColumnIndexes().isEmpty(), "Sorting applied"); this.nattable.doCommand(new SortColumnCommand(this.nattable, 3)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(1, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(SortDirectionEnum.ASC, sortModel.getSortDirection(2)); @@ -219,11 +219,11 @@ public class SortIntegrationTest { @Test public void shouldChangeSortColumnByCommand() { ISortModel sortModel = this.gridLayerStack.getSortHeaderLayer().getSortModel(); - assertTrue("Sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertTrue(sortModel.getSortedColumnIndexes().isEmpty(), "Sorting applied"); this.nattable.doCommand(new SortColumnCommand(this.nattable, 3)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(1, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(SortDirectionEnum.ASC, sortModel.getSortDirection(2)); @@ -231,7 +231,7 @@ public class SortIntegrationTest { // sort another column this.nattable.doCommand(new SortColumnCommand(this.nattable, 4)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(1, sortModel.getSortedColumnIndexes().size()); assertEquals(3, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(SortDirectionEnum.ASC, sortModel.getSortDirection(3)); @@ -240,11 +240,11 @@ public class SortIntegrationTest { @Test public void shouldChangeSortDirectionByCommand() { ISortModel sortModel = this.gridLayerStack.getSortHeaderLayer().getSortModel(); - assertTrue("Sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertTrue(sortModel.getSortedColumnIndexes().isEmpty(), "Sorting applied"); this.nattable.doCommand(new SortColumnCommand(this.nattable, 3)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(1, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(SortDirectionEnum.ASC, sortModel.getSortDirection(2)); @@ -252,7 +252,7 @@ public class SortIntegrationTest { // sort column again to change sort direction this.nattable.doCommand(new SortColumnCommand(this.nattable, 3)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(1, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(SortDirectionEnum.DESC, sortModel.getSortDirection(2)); @@ -261,11 +261,11 @@ public class SortIntegrationTest { @Test public void shouldRemoveSortByCommand() { ISortModel sortModel = this.gridLayerStack.getSortHeaderLayer().getSortModel(); - assertTrue("Sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertTrue(sortModel.getSortedColumnIndexes().isEmpty(), "Sorting applied"); this.nattable.doCommand(new SortColumnCommand(this.nattable, 3)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(1, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(SortDirectionEnum.ASC, sortModel.getSortDirection(2)); @@ -275,18 +275,18 @@ public class SortIntegrationTest { // sort column again to remove sorting this.nattable.doCommand(new SortColumnCommand(this.nattable, 3)); - assertTrue("Sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertTrue(sortModel.getSortedColumnIndexes().isEmpty(), "Sorting applied"); assertEquals(0, sortModel.getSortedColumnIndexes().size()); } @Test public void shouldAppendSortColumnsByCommand() { ISortModel sortModel = this.gridLayerStack.getSortHeaderLayer().getSortModel(); - assertTrue("Sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertTrue(sortModel.getSortedColumnIndexes().isEmpty(), "Sorting applied"); this.nattable.doCommand(new SortColumnCommand(this.nattable, 3)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(1, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(SortDirectionEnum.ASC, sortModel.getSortDirection(2)); @@ -294,7 +294,7 @@ public class SortIntegrationTest { // sort additional column this.nattable.doCommand(new SortColumnCommand(this.nattable, 4, true)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(2, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(3, sortModel.getSortedColumnIndexes().get(1).intValue()); @@ -304,7 +304,7 @@ public class SortIntegrationTest { // sort additional column this.nattable.doCommand(new SortColumnCommand(this.nattable, 5, true)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(3, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(3, sortModel.getSortedColumnIndexes().get(1).intValue()); @@ -317,11 +317,11 @@ public class SortIntegrationTest { @Test public void shouldChangeLastAppendedSortColumnByCommand() { ISortModel sortModel = this.gridLayerStack.getSortHeaderLayer().getSortModel(); - assertTrue("Sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertTrue(sortModel.getSortedColumnIndexes().isEmpty(), "Sorting applied"); this.nattable.doCommand(new SortColumnCommand(this.nattable, 3)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(1, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(SortDirectionEnum.ASC, sortModel.getSortDirection(2)); @@ -330,7 +330,7 @@ public class SortIntegrationTest { this.nattable.doCommand(new SortColumnCommand(this.nattable, 4, true)); this.nattable.doCommand(new SortColumnCommand(this.nattable, 5, true)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(3, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(3, sortModel.getSortedColumnIndexes().get(1).intValue()); @@ -342,7 +342,7 @@ public class SortIntegrationTest { // sort last sorted column again to change sort direction this.nattable.doCommand(new SortColumnCommand(this.nattable, 5, true)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(3, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(3, sortModel.getSortedColumnIndexes().get(1).intValue()); @@ -355,11 +355,11 @@ public class SortIntegrationTest { @Test public void shouldRemoveLastAppendedSortColumnByCommand() { ISortModel sortModel = this.gridLayerStack.getSortHeaderLayer().getSortModel(); - assertTrue("Sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertTrue(sortModel.getSortedColumnIndexes().isEmpty(), "Sorting applied"); this.nattable.doCommand(new SortColumnCommand(this.nattable, 3)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(1, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(SortDirectionEnum.ASC, sortModel.getSortDirection(2)); @@ -368,7 +368,7 @@ public class SortIntegrationTest { this.nattable.doCommand(new SortColumnCommand(this.nattable, 4, true)); this.nattable.doCommand(new SortColumnCommand(this.nattable, 5, true)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(3, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(3, sortModel.getSortedColumnIndexes().get(1).intValue()); @@ -381,7 +381,7 @@ public class SortIntegrationTest { this.nattable.doCommand(new SortColumnCommand(this.nattable, 5, true)); this.nattable.doCommand(new SortColumnCommand(this.nattable, 5, true)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(2, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(3, sortModel.getSortedColumnIndexes().get(1).intValue()); @@ -392,11 +392,11 @@ public class SortIntegrationTest { @Test public void shouldChangeFirstAppendedSortColumnByCommand() { ISortModel sortModel = this.gridLayerStack.getSortHeaderLayer().getSortModel(); - assertTrue("Sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertTrue(sortModel.getSortedColumnIndexes().isEmpty(), "Sorting applied"); this.nattable.doCommand(new SortColumnCommand(this.nattable, 3)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(1, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(SortDirectionEnum.ASC, sortModel.getSortDirection(2)); @@ -405,7 +405,7 @@ public class SortIntegrationTest { this.nattable.doCommand(new SortColumnCommand(this.nattable, 4, true)); this.nattable.doCommand(new SortColumnCommand(this.nattable, 5, true)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(3, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(3, sortModel.getSortedColumnIndexes().get(1).intValue()); @@ -417,7 +417,7 @@ public class SortIntegrationTest { // sort first sorted column again to change sort direction this.nattable.doCommand(new SortColumnCommand(this.nattable, 3, true)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(3, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(3, sortModel.getSortedColumnIndexes().get(1).intValue()); @@ -430,11 +430,11 @@ public class SortIntegrationTest { @Test public void shouldNotRemoveFirstAppendedSortColumnByCommand() { ISortModel sortModel = this.gridLayerStack.getSortHeaderLayer().getSortModel(); - assertTrue("Sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertTrue(sortModel.getSortedColumnIndexes().isEmpty(), "Sorting applied"); this.nattable.doCommand(new SortColumnCommand(this.nattable, 3)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(1, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(SortDirectionEnum.ASC, sortModel.getSortDirection(2)); @@ -443,7 +443,7 @@ public class SortIntegrationTest { this.nattable.doCommand(new SortColumnCommand(this.nattable, 4, true)); this.nattable.doCommand(new SortColumnCommand(this.nattable, 5, true)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(3, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(3, sortModel.getSortedColumnIndexes().get(1).intValue()); @@ -455,7 +455,7 @@ public class SortIntegrationTest { // sort first sorted column again to change sort direction this.nattable.doCommand(new SortColumnCommand(this.nattable, 3, true)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(3, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(3, sortModel.getSortedColumnIndexes().get(1).intValue()); @@ -468,7 +468,7 @@ public class SortIntegrationTest { // not be removed this.nattable.doCommand(new SortColumnCommand(this.nattable, 3, true)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(3, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(3, sortModel.getSortedColumnIndexes().get(1).intValue()); @@ -481,11 +481,11 @@ public class SortIntegrationTest { @Test public void shouldUpdateFirstAppendedSortColumnOnlyIfNotAccumulateByCommand() { ISortModel sortModel = this.gridLayerStack.getSortHeaderLayer().getSortModel(); - assertTrue("Sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertTrue(sortModel.getSortedColumnIndexes().isEmpty(), "Sorting applied"); this.nattable.doCommand(new SortColumnCommand(this.nattable, 3)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(1, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(SortDirectionEnum.ASC, sortModel.getSortDirection(2)); @@ -494,7 +494,7 @@ public class SortIntegrationTest { this.nattable.doCommand(new SortColumnCommand(this.nattable, 4, true)); this.nattable.doCommand(new SortColumnCommand(this.nattable, 5, true)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(3, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(3, sortModel.getSortedColumnIndexes().get(1).intValue()); @@ -507,7 +507,7 @@ public class SortIntegrationTest { // direction and remove other column sortings this.nattable.doCommand(new SortColumnCommand(this.nattable, 3)); - assertFalse("No sorting applied", sortModel.getSortedColumnIndexes().isEmpty()); + assertFalse(sortModel.getSortedColumnIndexes().isEmpty(), "No sorting applied"); assertEquals(1, sortModel.getSortedColumnIndexes().size()); assertEquals(2, sortModel.getSortedColumnIndexes().get(0).intValue()); assertEquals(SortDirectionEnum.DESC, sortModel.getSortDirection(2)); diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/tree/GlazedListTreeRowModelExpandCollapseTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/tree/GlazedListTreeRowModelExpandCollapseTest.java index 23852ef6..5c26c911 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/tree/GlazedListTreeRowModelExpandCollapseTest.java +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/tree/GlazedListTreeRowModelExpandCollapseTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2020 Dirk Fauth and others. + * Copyright (c) 2013, 2022 Dirk Fauth and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,10 +12,10 @@ *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.extension.glazedlists.tree; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.text.MessageFormat; import java.util.Comparator; @@ -26,8 +26,8 @@ import java.util.concurrent.atomic.AtomicInteger; import org.eclipse.nebula.widgets.nattable.dataset.person.Person; import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import ca.odell.glazedlists.EventList; import ca.odell.glazedlists.GlazedLists; @@ -40,7 +40,7 @@ public class GlazedListTreeRowModelExpandCollapseTest { private GlazedListTreeData treeData; private GlazedListTreeRowModel treeRowModel; - @Before + @BeforeEach public void setup() { EventList<Person> eventList = GlazedLists.eventList(PersonService.getFixedPersons()); @@ -53,7 +53,7 @@ public class GlazedListTreeRowModelExpandCollapseTest { @Test public void testInitialExpanded() { for (int i = 0; i < this.treeList.size(); i++) { - assertFalse("Node is not expanded", this.treeRowModel.isCollapsed(i)); + assertFalse(this.treeRowModel.isCollapsed(i), "Node is not expanded"); } } @@ -65,8 +65,8 @@ public class GlazedListTreeRowModelExpandCollapseTest { for (int i = 0; i < this.treeList.size(); i++) { assertTrue( - MessageFormat.format("Node at index {0} is expanded", i), - this.treeRowModel.isCollapsed(i)); + this.treeRowModel.isCollapsed(i), + MessageFormat.format("Node at index {0} is expanded", i)); } } @@ -76,8 +76,8 @@ public class GlazedListTreeRowModelExpandCollapseTest { for (int i = 0; i < this.treeList.size(); i++) { assertTrue( - MessageFormat.format("Node at index {0} is expanded", i), - this.treeRowModel.isCollapsed(i)); + this.treeRowModel.isCollapsed(i), + MessageFormat.format("Node at index {0} is expanded", i)); } } @@ -88,8 +88,8 @@ public class GlazedListTreeRowModelExpandCollapseTest { for (int i = 0; i < this.treeList.size(); i++) { assertFalse( - MessageFormat.format("Node at index {0} is collapsed", i), - this.treeRowModel.isCollapsed(i)); + this.treeRowModel.isCollapsed(i), + MessageFormat.format("Node at index {0} is collapsed", i)); } } @@ -101,8 +101,8 @@ public class GlazedListTreeRowModelExpandCollapseTest { for (int i = 0; i < this.treeList.size(); i++) { assertTrue( - MessageFormat.format("Node at index {0} is expanded", i), - this.treeRowModel.isCollapsed(i)); + this.treeRowModel.isCollapsed(i), + MessageFormat.format("Node at index {0} is expanded", i)); } } @@ -115,8 +115,8 @@ public class GlazedListTreeRowModelExpandCollapseTest { for (int i = 0; i < this.treeList.size(); i++) { assertFalse( - MessageFormat.format("Node at index {0} is collapsed", i), - this.treeRowModel.isCollapsed(i)); + this.treeRowModel.isCollapsed(i), + MessageFormat.format("Node at index {0} is collapsed", i)); } } @@ -129,33 +129,33 @@ public class GlazedListTreeRowModelExpandCollapseTest { @Test public void testExpandCollapseByIndex() { - assertFalse("Flanders is not expanded", this.treeRowModel.isCollapsed(0)); + assertFalse(this.treeRowModel.isCollapsed(0), "Flanders is not expanded"); // collapse Flanders this.treeRowModel.collapse(0); - assertTrue("Flanders is not expanded", this.treeRowModel.isCollapsed(0)); + assertTrue(this.treeRowModel.isCollapsed(0), "Flanders is not expanded"); // expand Flanders this.treeRowModel.expand(0); - assertFalse("Flanders is not expanded", this.treeRowModel.isCollapsed(0)); + assertFalse(this.treeRowModel.isCollapsed(0), "Flanders is not expanded"); } @Test public void testExpandCollapseByObject() { LastNameGroup flanders = new LastNameGroup(2, "Flanders"); - assertFalse("Flanders is not expanded", this.treeRowModel.isCollapsed(flanders)); + assertFalse(this.treeRowModel.isCollapsed(flanders), "Flanders is not expanded"); // collapse Flanders this.treeRowModel.collapse(flanders); - assertTrue("Flanders is not expanded", this.treeRowModel.isCollapsed(flanders)); + assertTrue(this.treeRowModel.isCollapsed(flanders), "Flanders is not expanded"); // expand Flanders this.treeRowModel.expand(flanders); - assertFalse("Flanders is not expanded", this.treeRowModel.isCollapsed(flanders)); + assertFalse(this.treeRowModel.isCollapsed(flanders), "Flanders is not expanded"); } @Test @@ -166,20 +166,20 @@ public class GlazedListTreeRowModelExpandCollapseTest { for (int i = 0; i < this.treeList.size(); i++) { assertTrue( - MessageFormat.format("Node at index {0} is expanded", i), - this.treeRowModel.isCollapsed(i)); + this.treeRowModel.isCollapsed(i), + MessageFormat.format("Node at index {0} is expanded", i)); } this.treeRowModel.expandToLevel(1); for (int i = 0; i < this.treeList.size(); i++) { if (this.treeList.get(i) instanceof LastNameGroup) { assertFalse( - MessageFormat.format("Node at index {0} is collapsed", i), - this.treeRowModel.isCollapsed(i)); + this.treeRowModel.isCollapsed(i), + MessageFormat.format("Node at index {0} is collapsed", i)); } else if (this.treeList.get(i) instanceof FirstNameGroup) { assertTrue( - MessageFormat.format("Node at index {0} is expanded", i), - this.treeRowModel.isCollapsed(i)); + this.treeRowModel.isCollapsed(i), + MessageFormat.format("Node at index {0} is expanded", i)); } else { // there should be no other values visible right now fail("Another object than LastNameGroup and FirstNameGroup is visible"); diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/DefaultGlazedListsFilterStrategy.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/DefaultGlazedListsFilterStrategy.java index 7427bdf2..3203d9a3 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/DefaultGlazedListsFilterStrategy.java +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/DefaultGlazedListsFilterStrategy.java @@ -206,7 +206,7 @@ public class DefaultGlazedListsFilterStrategy<T> implements IFilterStrategy<T> { } } - String[] separator = getSeparatorCharacters(textDelimiter); + String[] separator = FilterRowUtils.getSeparatorCharacters(textDelimiter); if (!stringMatcherEditors.isEmpty()) { CompositeMatcherEditor<T> stringCompositeMatcherEditor = new CompositeMatcherEditor<>(stringMatcherEditors); @@ -274,63 +274,6 @@ public class DefaultGlazedListsFilterStrategy<T> implements IFilterStrategy<T> { } } - // TODO 2.1 move constants and getSeparatorCharacters() to FilterRowUtils - - private static final String TWO_CHARACTER_REGEX = "\\[(((.){2})|((.)\\\\(.))|(\\\\(.){2})|(\\\\(.)\\\\(.)))\\]"; //$NON-NLS-1$ - private static final String MASKED_BACKSLASH = "\\\\"; //$NON-NLS-1$ - private static final String BACKSLASH_REPLACEMENT = "backslash"; //$NON-NLS-1$ - - /** - * This method tries to extract the AND and the OR character that should be - * used as delimiter, so that a user is able to specify the operation for - * combined filter criteria. If it does not start with [ and ends with ] and - * does not match one of the following regular expressions, this method - * returns <code>null</code> which causes the default behavior, e.g. OR for - * String matchers, AND for threshold matchers. - * <ul> - * <li>(.){2}</li> - * <li>(.)\\\\(.)</li> - * <li>\\\\(.){2}</li> - * <li>\\\\(.)\\\\(.)</li> - * </ul> - * - * @param delimiter - * The delimiter that is configured via - * {@link FilterRowConfigAttributes#TEXT_DELIMITER}. Can be - * <code>null</code>. - * @return String array with the configured AND and the configured OR - * character, or <code>null</code> if the delimiter is not a two - * character regular expression. The first element in the array is - * the AND character, the second element is the OR character. - */ - private String[] getSeparatorCharacters(String delimiter) { - // start with [ and end with ] - // (.){2} => e.g. ab - // (.)\\\\(.) => a\b - // \\\\(.){2} => \ab - // \\\\(.)\\\\(.) => \a\b - - if (delimiter != null && delimiter.matches(TWO_CHARACTER_REGEX)) { - String inspect = delimiter.substring(1, delimiter.length() - 1); - - // special handling if the backslash is used as delimiter for AND or - // OR - inspect = inspect.replace(MASKED_BACKSLASH, BACKSLASH_REPLACEMENT); - - // now replace all backslashed - inspect = inspect.replaceAll(MASKED_BACKSLASH, ""); //$NON-NLS-1$ - - // convert back the "backslash" to "\" - inspect = inspect.replace(BACKSLASH_REPLACEMENT, "\\"); //$NON-NLS-1$ - if (inspect.length() == 2) { - String[] result = new String[] { inspect.substring(0, 1), inspect.substring(1, 2) }; - return result; - } - } - - return null; - } - /** * Retrieves the {@link IDisplayConverter} that should be used for * converting the body content to string for text match filter operations. diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowUtils.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowUtils.java index 7b9348eb..d05497b3 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowUtils.java +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowUtils.java @@ -19,9 +19,17 @@ import java.util.List; import java.util.Scanner; import java.util.regex.Pattern; +import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry; +import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; +import org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor; +import org.eclipse.nebula.widgets.nattable.filterrow.FilterRowDataLayer; import org.eclipse.nebula.widgets.nattable.filterrow.ParseResult; import org.eclipse.nebula.widgets.nattable.filterrow.ParseResult.MatchType; import org.eclipse.nebula.widgets.nattable.filterrow.TextMatchingMode; +import org.eclipse.nebula.widgets.nattable.filterrow.combobox.FilterRowComboBoxCellEditor; +import org.eclipse.nebula.widgets.nattable.filterrow.config.FilterRowConfigAttributes; +import org.eclipse.nebula.widgets.nattable.grid.GridRegion; +import org.eclipse.nebula.widgets.nattable.style.DisplayMode; import ca.odell.glazedlists.matchers.ThresholdMatcherEditor; @@ -139,4 +147,81 @@ public final class FilterRowUtils { thresholdMatcherEditor.setMatchOperation(ThresholdMatcherEditor.EQUAL); } } + + private static final String TWO_CHARACTER_REGEX = "\\[(((.){2})|((.)\\\\(.))|(\\\\(.){2})|(\\\\(.)\\\\(.)))\\]"; //$NON-NLS-1$ + private static final String MASKED_BACKSLASH = "\\\\"; //$NON-NLS-1$ + private static final String BACKSLASH_REPLACEMENT = "backslash"; //$NON-NLS-1$ + + /** + * This method tries to extract the AND and the OR character that should be + * used as delimiter, so that a user is able to specify the operation for + * combined filter criteria. If it does not start with [ and ends with ] and + * does not match one of the following regular expressions, this method + * returns <code>null</code> which causes the default behavior, e.g. OR for + * String matchers, AND for threshold matchers. + * <ul> + * <li>(.){2}</li> + * <li>(.)\\\\(.)</li> + * <li>\\\\(.){2}</li> + * <li>\\\\(.)\\\\(.)</li> + * </ul> + * + * @param delimiter + * The delimiter that is configured via + * {@link FilterRowConfigAttributes#TEXT_DELIMITER}. Can be + * <code>null</code>. + * @return String array with the configured AND and the configured OR + * character, or <code>null</code> if the delimiter is not a two + * character regular expression. The first element in the array is + * the AND character, the second element is the OR character. + * @since 2.1 + */ + public static String[] getSeparatorCharacters(String delimiter) { + // start with [ and end with ] + // (.){2} => e.g. ab + // (.)\\\\(.) => a\b + // \\\\(.){2} => \ab + // \\\\(.)\\\\(.) => \a\b + + if (delimiter != null && delimiter.matches(TWO_CHARACTER_REGEX)) { + String inspect = delimiter.substring(1, delimiter.length() - 1); + + // special handling if the backslash is used as delimiter for AND or + // OR + inspect = inspect.replace(MASKED_BACKSLASH, BACKSLASH_REPLACEMENT); + + // now replace all backslashed + inspect = inspect.replaceAll(MASKED_BACKSLASH, ""); //$NON-NLS-1$ + + // convert back the "backslash" to "\" + inspect = inspect.replace(BACKSLASH_REPLACEMENT, "\\"); //$NON-NLS-1$ + if (inspect.length() == 2) { + String[] result = new String[] { inspect.substring(0, 1), inspect.substring(1, 2) }; + return result; + } + } + + return null; + } + + /** + * + * @param configRegistry + * The {@link IConfigRegistry} needed to retrieve the configured + * cell editor. + * @param columnIndex + * The column index for which the filter editor should be + * inspected. + * @return <code>true</code> if the filter editor configured for the given + * column index is of type {@link FilterRowComboBoxCellEditor}. + * + * @since 2.1 + */ + public static boolean isFilterRowComboBoxCellEditor(IConfigRegistry configRegistry, int columnIndex) { + ICellEditor cellEditor = configRegistry.getConfigAttribute( + EditConfigAttributes.CELL_EDITOR, + DisplayMode.NORMAL, + FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + columnIndex, GridRegion.FILTER_ROW); + return (cellEditor instanceof FilterRowComboBoxCellEditor); + } }
\ No newline at end of file diff --git a/org.eclipse.nebula.widgets.nattable.test.performance/META-INF/MANIFEST.MF b/org.eclipse.nebula.widgets.nattable.test.performance/META-INF/MANIFEST.MF index 7f74bc5d..8dfa0c8c 100644 --- a/org.eclipse.nebula.widgets.nattable.test.performance/META-INF/MANIFEST.MF +++ b/org.eclipse.nebula.widgets.nattable.test.performance/META-INF/MANIFEST.MF @@ -47,8 +47,6 @@ Import-Package: ca.odell.glazedlists, org.eclipse.swt.graphics, org.eclipse.swt.layout, org.eclipse.swt.widgets, - org.hamcrest;version="1.1.0";resolution:=optional, - org.hamcrest.core;version="1.1.0";resolution:=optional, - org.junit + org.junit.jupiter.api;version="5.9.1" Bundle-Vendor: Eclipse Nebula NatTable Automatic-Module-Name: org.eclipse.nebula.widgets.nattable.test.performance diff --git a/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/AbstractLayerPerformanceTest.java b/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/AbstractLayerPerformanceTest.java index 65a8673a..e5afa85a 100644 --- a/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/AbstractLayerPerformanceTest.java +++ b/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/AbstractLayerPerformanceTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,14 +12,16 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.test.performance; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.layer.ILayer; import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Shell; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; public abstract class AbstractLayerPerformanceTest { @@ -43,7 +45,7 @@ public abstract class AbstractLayerPerformanceTest { this.expectedTimeInMillis = expectedTimeInMillis; } - @Before + @BeforeEach public void setup() { this.layer = null; this.expectedTimeInMillis = DEFAULT_THRESHOLD; @@ -55,9 +57,9 @@ public abstract class AbstractLayerPerformanceTest { } - @After + @AfterEach public void tearDown() { - Assert.assertNotNull("Layer was not set", this.layer); + assertNotNull(this.layer, "Layer was not set"); new NatTable(getShell(), this.layer) { @Override @@ -70,9 +72,10 @@ public abstract class AbstractLayerPerformanceTest { long actualTimeInMillis = stopTimeInMillis - startTimeInMillis; System.out.println("duration = " + actualTimeInMillis + " milliseconds"); - Assert.assertTrue("Expected to take less than " + AbstractLayerPerformanceTest.this.expectedTimeInMillis - + " milliseconds but took " + actualTimeInMillis - + " milliseconds", actualTimeInMillis < AbstractLayerPerformanceTest.this.expectedTimeInMillis); + assertTrue(actualTimeInMillis < AbstractLayerPerformanceTest.this.expectedTimeInMillis, + "Expected to take less than " + AbstractLayerPerformanceTest.this.expectedTimeInMillis + + " milliseconds but took " + actualTimeInMillis + + " milliseconds"); } }; diff --git a/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/BodyStackLayerPerformanceTest.java b/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/BodyStackLayerPerformanceTest.java index f4dd8ae9..0269417d 100644 --- a/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/BodyStackLayerPerformanceTest.java +++ b/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/BodyStackLayerPerformanceTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -20,14 +20,14 @@ import org.eclipse.nebula.widgets.nattable.layer.stack.DefaultBodyLayerStack; import org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer; import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; public class BodyStackLayerPerformanceTest extends AbstractLayerPerformanceTest { static IDataProvider provider; - @BeforeClass + @BeforeAll public static void init() { provider = new DummyBodyDataProvider(100000, 100000); } diff --git a/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/CompositeLayerPerformanceTest.java b/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/CompositeLayerPerformanceTest.java index a227d707..58d77082 100644 --- a/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/CompositeLayerPerformanceTest.java +++ b/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/CompositeLayerPerformanceTest.java @@ -24,7 +24,7 @@ import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.layer.ILayer; import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class CompositeLayerPerformanceTest extends AbstractLayerPerformanceTest { diff --git a/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/ElementalLayerPerformanceTest.java b/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/ElementalLayerPerformanceTest.java index ec90bf74..d99d55c9 100644 --- a/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/ElementalLayerPerformanceTest.java +++ b/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/ElementalLayerPerformanceTest.java @@ -19,7 +19,7 @@ import org.eclipse.nebula.widgets.nattable.layer.CompositeLayer; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer; import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ElementalLayerPerformanceTest extends AbstractLayerPerformanceTest { diff --git a/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/ElementalViewportLayerPerformanceTest.java b/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/ElementalViewportLayerPerformanceTest.java index 8ec76bfa..19aba23b 100644 --- a/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/ElementalViewportLayerPerformanceTest.java +++ b/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/ElementalViewportLayerPerformanceTest.java @@ -22,7 +22,7 @@ import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer; import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ElementalViewportLayerPerformanceTest extends AbstractLayerPerformanceTest { diff --git a/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/ListDataProviderPerformanceTest.java b/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/ListDataProviderPerformanceTest.java index 9e8f742f..27adda3b 100644 --- a/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/ListDataProviderPerformanceTest.java +++ b/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/ListDataProviderPerformanceTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,6 +12,8 @@ ******************************************************************************/ package org.eclipse.nebula.widgets.nattable.test.performance; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.util.List; import java.util.Map; @@ -22,8 +24,7 @@ import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixtu import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsDataProvider; import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider; import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; import ca.odell.glazedlists.GlazedLists; @@ -35,7 +36,7 @@ public class ListDataProviderPerformanceTest extends @Test public void performanceOfListDataProvider() throws Exception { List<RowDataFixture> largeList = RowDataListFixture.getList(26000); - Assert.assertTrue(largeList.size() > 25000); + assertTrue(largeList.size() > 25000); this.layer = new DefaultGridLayer(largeList, RowDataListFixture.getPropertyNames(), @@ -50,7 +51,7 @@ public class ListDataProviderPerformanceTest extends .getPropertyToLabelMap(); List<RowDataFixture> largeList = RowDataListFixture.getList(26000); - Assert.assertTrue(largeList.size() > 25000); + assertTrue(largeList.size() > 25000); IDataProvider glazedListsDataProvider = new GlazedListsDataProvider<RowDataFixture>( GlazedLists.eventList(largeList), diff --git a/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/TreeLayerPerformanceTest.java b/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/TreeLayerPerformanceTest.java index 6e4ad1a9..b59fafc7 100644 --- a/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/TreeLayerPerformanceTest.java +++ b/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/TreeLayerPerformanceTest.java @@ -13,7 +13,7 @@ *****************************************************************************/ package org.eclipse.nebula.widgets.nattable.test.performance; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.ArrayList; import java.util.Comparator; @@ -36,7 +36,7 @@ import org.eclipse.nebula.widgets.nattable.tree.ITreeData; import org.eclipse.nebula.widgets.nattable.tree.ITreeRowModel; import org.eclipse.nebula.widgets.nattable.tree.TreeLayer; import org.eclipse.nebula.widgets.nattable.tree.TreeRowModel; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class TreeLayerPerformanceTest { @@ -69,12 +69,14 @@ </modules> <properties> - <tycho-version>2.0.0</tycho-version> + <tycho-version>3.0.1</tycho-version> <cbi-version>1.3.4</cbi-version> <nattable-version>${project.version}</nattable-version> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> + + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <jacoco.version>0.8.5</jacoco.version> <sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/../org.eclipse.nebula.widgets.nattable.updatesite/target/site/jacoco-aggregate/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths> @@ -146,6 +148,7 @@ </artifact> </target> <targetDefinitionIncludeSource>honor</targetDefinitionIncludeSource> + <executionEnvironment>JavaSE-1.8</executionEnvironment> <environments> <environment> <os>win32</os> @@ -178,6 +181,15 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.eclipse.tycho</groupId> + <artifactId>tycho-compiler-plugin</artifactId> + <version>${tycho-version}</version> + <configuration> + <useJDK>BREE</useJDK> + <requireJREPackageImports>true</requireJREPackageImports> + </configuration> + </plugin> </plugins> <pluginManagement> diff --git a/target-platform/target-platform.target b/target-platform/target-platform.target index 31eb30ae..5acd3220 100644 --- a/target-platform/target-platform.target +++ b/target-platform/target-platform.target @@ -1,20 +1,19 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <?pde?> -<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl --> <target name="NatTable Target Definition" sequenceNumber="1605535427"> <locations> - <location includeMode="slicer" includeAllPlatforms="true" includeSource="true" includeConfigurePhase="false" type="InstallableUnit"> + <location includeAllPlatforms="true" includeConfigurePhase="false" includeMode="slicer" includeSource="true" type="InstallableUnit"> <unit id="org.eclipse.equinox.executable.feature.group" version="3.8.500.v20190907-0428"/> <unit id="org.eclipse.sdk.ide" version="4.13.0.I20190916-1045"/> <unit id="org.eclipse.equinox.sdk.feature.group" version="3.19.0.v20190907-0428"/> <unit id="org.eclipse.emf.sdk.feature.group" version="2.19.0.v20190824-1315"/> <repository location="https://download.eclipse.org/releases/2019-09/"/> </location> - <location includeMode="slicer" includeAllPlatforms="true" includeSource="true" includeConfigurePhase="false" type="InstallableUnit"> + <location includeAllPlatforms="true" includeConfigurePhase="false" includeMode="slicer" includeSource="true" type="InstallableUnit"> <unit id="com.ibm.icu.base" version="58.2.0.v20181010-1334"/> <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/R20191126223242/repository"/> </location> - <location includeMode="slicer" includeAllPlatforms="true" includeSource="true" includeConfigurePhase="false" type="InstallableUnit"> + <location includeAllPlatforms="true" includeConfigurePhase="false" includeMode="slicer" includeSource="true" type="InstallableUnit"> <unit id="ca.odell.glazedlists" version="1.11.0.v20190926-1838"/> <unit id="org.apache.commons.collections4" version="4.4.0.v20200420-1700"/> <unit id="org.apache.commons.codec" version="1.14.0.v20200818-1422"/> @@ -24,19 +23,39 @@ <unit id="org.slf4j.binding.simple" version="1.7.30.v20200204-2150"/> <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/R20200831200620/repository"/> </location> - <location includeMode="slicer" includeAllPlatforms="true" includeSource="true" includeConfigurePhase="false" type="InstallableUnit"> + <location includeAllPlatforms="true" includeConfigurePhase="false" includeMode="slicer" includeSource="true" type="InstallableUnit"> <unit id="org.eclipse.nebula.cwt.feature.feature.group" version="1.1.0.202011020719"/> <unit id="org.eclipse.nebula.widgets.cdatetime.feature.feature.group" version="1.5.0.202011020719"/> <unit id="org.eclipse.nebula.widgets.richtext.feature.feature.group" version="1.4.0.202011020719"/> <repository location="https://download.eclipse.org/nebula/releases/2.4.3/"/> </location> - <location includeMode="slicer" includeAllPlatforms="true" includeSource="true" includeConfigurePhase="false" type="InstallableUnit"> + <location includeAllPlatforms="true" includeConfigurePhase="false" includeMode="slicer" includeSource="true" type="InstallableUnit"> <unit id="org.eclipse.collections.feature.feature.group" version="10.4.0.v20200820-2049"/> <repository location="https://download.eclipse.org/collections/10.4.0/repository"/> </location> - <location includeMode="slicer" includeAllPlatforms="true" includeSource="true" includeConfigurePhase="false" type="InstallableUnit"> + <location includeAllPlatforms="true" includeConfigurePhase="false" includeMode="slicer" includeSource="true" type="InstallableUnit"> <unit id="org.eclipse.license.feature.group" version="2.0.2.v20181016-2210"/> <repository location="http://download.eclipse.org/cbi/updates/license"/> </location> + <location includeDependencyDepth="infinite" includeDependencyScopes="compile" includeSource="true" missingManifest="generate" type="Maven"> + <dependencies> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-engine</artifactId> + <version>5.9.1</version> + <type>jar</type> + </dependency> + </dependencies> + </location> + <location includeDependencyDepth="infinite" includeDependencyScopes="compile" includeSource="true" missingManifest="generate" type="Maven"> + <dependencies> + <dependency> + <groupId>org.junit.platform</groupId> + <artifactId>junit-platform-launcher</artifactId> + <version>1.9.1</version> + <type>jar</type> + </dependency> + </dependencies> + </location> </locations> -</target> +</target>
\ No newline at end of file |
