diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/fbtype/EventInOutputsTabTests.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/fbtype/EventInOutputsTabTests.java index b435a09d25..205a007dbc 100644 --- a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/fbtype/EventInOutputsTabTests.java +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/fbtype/EventInOutputsTabTests.java @@ -15,11 +15,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.eclipse.fordiac.ide.test.ui.helpers.UITestPinHelper; -import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotPropertySheet; import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotFBType; import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotNatTable; +import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotPropertySheet; import org.eclipse.fordiac.ide.test.ui.helpers.UITestNamesHelper; +import org.eclipse.fordiac.ide.test.ui.helpers.UITestPinHelper; import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacGefEditor; import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacNatTable; import org.eclipse.nebula.widgets.nattable.NatTable; @@ -33,9 +33,9 @@ public class EventInOutputsTabTests extends NatTableWithEditorBehaviorTests { @Override @BeforeEach public void operationsInitialization() { - TESTVAR1 = UITestPinHelper.EI1; - TESTVAR2 = UITestPinHelper.EI2; - TESTVAR3 = UITestPinHelper.EI3; + testvar1 = UITestPinHelper.EI1; + testvar2 = UITestPinHelper.EI2; + testvar3 = UITestPinHelper.EI3; final SWTBotFBType fbTypeBot = new SWTBotFBType(bot); fbTypeBot.createFBType(UITestNamesHelper.PROJECT_NAME, UITestNamesHelper.FBT_TEST_PROJECT2, UITestNamesHelper.ADAPTER); @@ -46,21 +46,21 @@ public void operationsInitialization() { bot.editorByTitle(UITestNamesHelper.FBT_TEST_PROJECT2).show(); SWTBotPropertySheet.selectPropertyTabItem(UITestNamesHelper.EVENT_IN_AND_OUTPUTS, propertiesBot); natTable = propertiesBot.widget(WidgetMatcherFactory.widgetOfType(NatTable.class), 0); - natTableBot = new SWTBot4diacNatTable(natTable); + swt4diacNatTable = new SWTBot4diacNatTable(natTable); editor = (SWTBot4diacGefEditor) bot.gefEditor(UITestNamesHelper.FBT_TEST_PROJECT2); assertNotNull(editor); - SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot); + new SWTBotNatTable(bot, swt4diacNatTable).createNewVariableInDataTypeEditor(); } @Override @Test public void changeDataTypeOfVariable() { - natTableBot.doubleclick(1, 2); - natTableBot.setCellDataValueByPosition(1, 2, UITestNamesHelper.TESTVAR); - natTableBot.doubleclick(1, 2); + swt4diacNatTable.doubleclick(1, 2); + swt4diacNatTable.setCellDataValueByPosition(1, 2, UITestNamesHelper.TESTVAR); + swt4diacNatTable.doubleclick(1, 2); // Initial value will successfully changed with error - assertEquals(natTableBot.getCellDataValueByPosition(1, 2), UITestNamesHelper.EVENT); + assertEquals(swt4diacNatTable.getCellDataValueByPosition(1, 2), UITestNamesHelper.EVENT); } @Override diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/fbtype/NatTableWithEditorBehaviorTests.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/fbtype/NatTableWithEditorBehaviorTests.java index 8cea8599ec..8d9824b802 100644 --- a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/fbtype/NatTableWithEditorBehaviorTests.java +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/fbtype/NatTableWithEditorBehaviorTests.java @@ -29,13 +29,13 @@ import org.junit.jupiter.api.Test; public abstract class NatTableWithEditorBehaviorTests extends Abstract4diacUITests { - protected static SWTBot4diacNatTable natTableBot; - protected static NatTable natTable; - protected static SWTBot4diacGefEditor editor; + protected SWTBot4diacNatTable swt4diacNatTable; + protected NatTable natTable; + protected SWTBot4diacGefEditor editor; - protected static String TESTVAR1 = "TESTVAR1"; //$NON-NLS-1$ - protected static String TESTVAR2 = "TESTVAR2"; //$NON-NLS-1$ - protected static String TESTVAR3 = "TESTVAR3"; //$NON-NLS-1$ + protected String testvar1 = "TESTVAR1"; //$NON-NLS-1$ + protected String testvar2 = "TESTVAR2"; //$NON-NLS-1$ + protected String testvar3 = "TESTVAR3"; //$NON-NLS-1$ /** * Initializes the environment for testing operations on the DataType Editor @@ -45,7 +45,6 @@ public abstract class NatTableWithEditorBehaviorTests extends Abstract4diacUITes * its visibility in the system explorer, opens the project in the editor, and * prepares the NatTable for testing by creating a new variable in the table. */ - @SuppressWarnings("static-method") @BeforeEach public void operationsInitialization() { final SWTBotFBType fbTypeBot = new SWTBotFBType(bot); @@ -54,8 +53,8 @@ public void operationsInitialization() { fbTypeBot.openFBTypeInEditor(UITestNamesHelper.PROJECT_NAME, UITestNamesHelper.FBT_TEST_PROJECT2); final Composite tableComposite = (Composite) bot.editorByTitle(UITestNamesHelper.FBT_TEST_PROJECT2).getWidget(); natTable = bot.widget(WidgetMatcherFactory.widgetOfType(NatTable.class), tableComposite); - natTableBot = new SWTBot4diacNatTable(natTable); - SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot); + swt4diacNatTable = new SWTBot4diacNatTable(natTable); + new SWTBotNatTable(bot, swt4diacNatTable).createNewVariableInDataTypeEditor(); } /** @@ -77,11 +76,10 @@ public void resetEnvironment() { * This method verifies that a new event can be created successfully by checking * the presence of the new variable in the editor. */ - @SuppressWarnings("static-method") @Test public void createEvent() { - SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot); - assertNotNull(editor.getEditPart(TESTVAR1)); + new SWTBotNatTable(bot, swt4diacNatTable).createNewVariableInDataTypeEditor(); + assertNotNull(editor.getEditPart(testvar1)); } /** @@ -90,11 +88,10 @@ public void createEvent() { * This method verifies that an event can be removed successfully by checking * the absence of the variable in the editor after deletion. */ - @SuppressWarnings("static-method") @Test public void removeEvent() { - SWTBotNatTable.deleteVariable(natTableBot, 3); - assertNull(editor.getEditPart(TESTVAR1)); + new SWTBotNatTable(bot, swt4diacNatTable).deleteVariable(3); + assertNull(editor.getEditPart(testvar1)); } /** @@ -104,12 +101,11 @@ public void removeEvent() { * checks that the old name is no longer present in the editor, while the new * name is. */ - @SuppressWarnings("static-method") @Test public void changeEventName() { - assertNotNull(editor.getEditPart(TESTVAR1)); - SWTBotNatTable.changeCellValueInNatTbale(natTableBot, UITestNamesHelper.TESTVAR, 3, 1); - assertNull(editor.getEditPart(TESTVAR1)); + assertNotNull(editor.getEditPart(testvar1)); + new SWTBotNatTable(bot, swt4diacNatTable).changeCellValueInNatTbale(UITestNamesHelper.TESTVAR, 3, 1); + assertNull(editor.getEditPart(testvar1)); assertNotNull(editor.getEditPart(UITestNamesHelper.TESTVAR)); } @@ -119,12 +115,11 @@ public void changeEventName() { * This method verifies that the event name can be changed using the rename * button tool and checks the presence of the new name in the editor. */ - @SuppressWarnings("static-method") @Test public void changeEventNameFromRenameButtom() { - assertNotNull(editor.getEditPart(TESTVAR1)); - SWTBotNatTable.changeVariableNameWithButtonTool(natTableBot, 3, UITestNamesHelper.TESTVAR); - assertNull(editor.getEditPart(TESTVAR1)); + assertNotNull(editor.getEditPart(testvar1)); + new SWTBotNatTable(bot, swt4diacNatTable).changeVariableNameWithButtonTool(3, UITestNamesHelper.TESTVAR); + assertNull(editor.getEditPart(testvar1)); assertNotNull(editor.getEditPart(UITestNamesHelper.TESTVAR)); } @@ -137,7 +132,7 @@ public void changeEventNameFromRenameButtom() { @SuppressWarnings("static-method") @Test public void changeDataTypeOfVariable() { - SWTBotNatTable.changeDataType(natTableBot, 1, UITestNamesHelper.INT_SMALL); + new SWTBotNatTable(bot, swt4diacNatTable).changeDataType(1, UITestNamesHelper.INT_SMALL); } /** @@ -149,7 +144,7 @@ public void changeDataTypeOfVariable() { @SuppressWarnings("static-method") @Test public void tryToSetInValidDataType() { - SWTBotNatTable.setInvalidDataType(natTableBot, 1, 2, UITestNamesHelper.TESTVAR); + new SWTBotNatTable(bot, swt4diacNatTable).setInvalidDataType(1, 2, UITestNamesHelper.TESTVAR); } /** @@ -158,12 +153,11 @@ public void tryToSetInValidDataType() { * This method verifies the ability to change the comment associated with an * event and checks for the expected changes in the editor. */ - @SuppressWarnings("static-method") @Test public void changeEventComment() { - assertNotNull(editor.getEditPart(TESTVAR1)); + assertNotNull(editor.getEditPart(testvar1)); assertNull(editor.getEditPart(UITestNamesHelper.TESTVAR)); - SWTBotNatTable.changeCellValueInNatTbale(natTableBot, UITestNamesHelper.TEST_COMMENT, 3, 3); + new SWTBotNatTable(bot, swt4diacNatTable).changeCellValueInNatTbale(UITestNamesHelper.TEST_COMMENT, 3, 3); } /** @@ -175,10 +169,11 @@ public void changeEventComment() { @SuppressWarnings("static-method") @Test public void moveEventUpDown() { - SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot); - SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot); - SWTBotNatTable.moveElementUp(natTableBot, 5); - SWTBotNatTable.moveElementDown(natTableBot, 3); + final SWTBotNatTable swtBotNatTable = new SWTBotNatTable(bot, swt4diacNatTable); + swtBotNatTable.createNewVariableInDataTypeEditor(); + swtBotNatTable.createNewVariableInDataTypeEditor(); + swtBotNatTable.moveElementUp(5); + swtBotNatTable.moveElementDown(3); } /** @@ -187,15 +182,15 @@ public void moveEventUpDown() { * This method checks whether the editor prevents changing an event name to a * name that already exists in the DataType Editor Table. */ - @SuppressWarnings("static-method") @Test public void tryToChangeEventNameWithExistingName() { - SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot); - assertNotNull(editor.getEditPart(TESTVAR1)); - assertNotNull(editor.getEditPart(TESTVAR2)); - SWTBotNatTable.changeNameWithExistingName(natTableBot, 4, TESTVAR1, TESTVAR2); - assertNotNull(editor.getEditPart(TESTVAR1)); - assertNotNull(editor.getEditPart(TESTVAR2)); + final SWTBotNatTable swtBotNatTable = new SWTBotNatTable(bot, swt4diacNatTable); + swtBotNatTable.createNewVariableInDataTypeEditor(); + assertNotNull(editor.getEditPart(testvar1)); + assertNotNull(editor.getEditPart(testvar2)); + swtBotNatTable.changeNameWithExistingName(4, testvar1, testvar2); + assertNotNull(editor.getEditPart(testvar1)); + assertNotNull(editor.getEditPart(testvar2)); } /** @@ -204,14 +199,14 @@ public void tryToChangeEventNameWithExistingName() { * This method verifies the editor's response when an invalid name is assigned * to an event, ensuring that invalid names are not accepted. */ - @SuppressWarnings("static-method") @Test public void tryToSetInvalidName() { - SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot); - assertNotNull(editor.getEditPart(TESTVAR1)); - SWTBotNatTable.setInvalidName(natTableBot, 3, UITestNamesHelper.IF, TESTVAR1); + final SWTBotNatTable swtBotNatTable = new SWTBotNatTable(bot, swt4diacNatTable); + swtBotNatTable.createNewVariableInDataTypeEditor(); + assertNotNull(editor.getEditPart(testvar1)); + swtBotNatTable.setInvalidName(3, UITestNamesHelper.IF, testvar1); assertNull(editor.getEditPart(UITestNamesHelper.IF)); - assertNotNull(editor.getEditPart(TESTVAR2)); + assertNotNull(editor.getEditPart(testvar2)); } } diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/fbtype/VarInAndOutputsTabTests.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/fbtype/VarInAndOutputsTabTests.java index 9a7851f4d5..9941219bbe 100644 --- a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/fbtype/VarInAndOutputsTabTests.java +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/fbtype/VarInAndOutputsTabTests.java @@ -16,11 +16,11 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import org.eclipse.fordiac.ide.model.datatype.helper.RetainHelper.RetainTag; -import org.eclipse.fordiac.ide.test.ui.helpers.UITestPinHelper; -import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotPropertySheet; import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotFBType; import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotNatTable; +import org.eclipse.fordiac.ide.test.ui.helpers.SWTBotPropertySheet; import org.eclipse.fordiac.ide.test.ui.helpers.UITestNamesHelper; +import org.eclipse.fordiac.ide.test.ui.helpers.UITestPinHelper; import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacGefEditor; import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacNatTable; import org.eclipse.nebula.widgets.nattable.NatTable; @@ -34,9 +34,9 @@ public class VarInAndOutputsTabTests extends NatTableWithEditorBehaviorTests { @Override @BeforeEach public void operationsInitialization() { - TESTVAR1 = UITestPinHelper.DI1; - TESTVAR2 = UITestPinHelper.DI2; - TESTVAR3 = UITestPinHelper.DI3; + testvar1 = UITestPinHelper.DI1; + testvar2 = UITestPinHelper.DI2; + testvar3 = UITestPinHelper.DI3; final SWTBotFBType fbTypeBot = new SWTBotFBType(bot); fbTypeBot.createFBType(UITestNamesHelper.PROJECT_NAME, UITestNamesHelper.FBT_TEST_PROJECT2, UITestNamesHelper.ADAPTER); @@ -47,10 +47,10 @@ public void operationsInitialization() { bot.editorByTitle(UITestNamesHelper.FBT_TEST_PROJECT2).show(); SWTBotPropertySheet.selectPropertyTabItem(UITestNamesHelper.VAR_IN_AND_OUTPUTS, propertiesBot); natTable = propertiesBot.widget(WidgetMatcherFactory.widgetOfType(NatTable.class), 0); - natTableBot = new SWTBot4diacNatTable(natTable); + swt4diacNatTable = new SWTBot4diacNatTable(natTable); editor = (SWTBot4diacGefEditor) bot.gefEditor(UITestNamesHelper.FBT_TEST_PROJECT2); assertNotNull(editor); - SWTBotNatTable.createNewVariableInDataTypeEditor(natTableBot); + new SWTBotNatTable(bot, swt4diacNatTable).createNewVariableInDataTypeEditor(); } /** @@ -59,11 +59,11 @@ public void operationsInitialization() { * This test checks whether the initial value of a variable can be changed, and * asserts that the new value is correctly assigned. */ - @SuppressWarnings("static-method") @Test public void changeInitialValueOfVariable() { - SWTBotNatTable.changeCellValueInNatTbale(natTableBot, UITestNamesHelper.TRUE, 1, 4); - SWTBotNatTable.changeCellValueInNatTbale(natTableBot, "1", 1, 4); //$NON-NLS-1$ + final SWTBotNatTable swtBotNatTable = new SWTBotNatTable(bot, swt4diacNatTable); + swtBotNatTable.changeCellValueInNatTbale(UITestNamesHelper.TRUE, 1, 4); + swtBotNatTable.changeCellValueInNatTbale("1", 1, 4); //$NON-NLS-1$ } /** @@ -73,10 +73,9 @@ public void changeInitialValueOfVariable() { * verifies whether the assignment is successful and what impact it has on the * editor. */ - @SuppressWarnings("static-method") @Test public void tryToSetInValidInitialValue() { - SWTBotNatTable.setInvalidDataType(natTableBot, 1, 4, UITestNamesHelper.TESTVAR); + new SWTBotNatTable(bot, swt4diacNatTable).setInvalidDataType(1, 4, UITestNamesHelper.TESTVAR); } /** @@ -85,12 +84,11 @@ public void tryToSetInValidInitialValue() { * This test verifies the toggling behavior of a variable's configuration * setting, ensuring that the value switches between "true" and "false". */ - @SuppressWarnings("static-method") @Test public void toggleVarConfiguration() { - assertEquals(natTableBot.getCellDataValueByPosition(2, 6), UITestNamesHelper.FALSE_SMALL); - natTableBot.click(2, 6); - assertEquals(natTableBot.getCellDataValueByPosition(2, 6), UITestNamesHelper.TRUE_SMALL); + assertEquals(swt4diacNatTable.getCellDataValueByPosition(2, 6), UITestNamesHelper.FALSE_SMALL); + swt4diacNatTable.click(2, 6); + assertEquals(swt4diacNatTable.getCellDataValueByPosition(2, 6), UITestNamesHelper.TRUE_SMALL); } /** @@ -99,12 +97,11 @@ public void toggleVarConfiguration() { * This test checks the toggling behavior of a variable's visibility setting, * confirming that the value alternates between "true" and "false". */ - @SuppressWarnings("static-method") @Test public void toggleVarVisibility() { - assertEquals(natTableBot.getCellDataValueByPosition(2, 5), UITestNamesHelper.TRUE_SMALL); - natTableBot.click(2, 5); - assertEquals(natTableBot.getCellDataValueByPosition(2, 5), UITestNamesHelper.FALSE_SMALL); + assertEquals(swt4diacNatTable.getCellDataValueByPosition(2, 5), UITestNamesHelper.TRUE_SMALL); + swt4diacNatTable.click(2, 5); + assertEquals(swt4diacNatTable.getCellDataValueByPosition(2, 5), UITestNamesHelper.FALSE_SMALL); } /** @@ -114,9 +111,8 @@ public void toggleVarVisibility() { * successfully and checks that the new retain tag value is correctly set in the * NatTable. */ - @SuppressWarnings("static-method") @Test public void changeRetainTag() { - SWTBotNatTable.setRetainValue(natTableBot, 1, 7, RetainTag.RETAIN); + new SWTBotNatTable(bot, swt4diacNatTable).setRetainValue(1, 7, RetainTag.RETAIN); } } diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/SWTBotNatTable.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/SWTBotNatTable.java index 5d1ec8ff46..ac52b8bb6d 100644 --- a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/SWTBotNatTable.java +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/SWTBotNatTable.java @@ -31,7 +31,6 @@ public class SWTBotNatTable { private final SWT4diacGefBot bot; private final SWTBot4diacNatTable natTable; - @SuppressWarnings("static-access") public SWTBotNatTable(final SWT4diacGefBot bot, final SWTBot4diacNatTable natTableBot) { this.bot = bot; this.natTable = natTableBot;