@Test
 public void saveBonusTest() {
   expectedImsBonusEntity.setSearchFieldText(existingTemplate);
   expectedImsBonusEntity.setSelectedTemplateName(existingTemplate);
   expectedImsBonusEntity.setAvailableTemplates(Arrays.asList(existingTemplate));
   expectedImsBonusEntity.setSourceForBonusCalcAmount("No amount required");
   // WHEN
   imsBonusPage =
       (ImsBonusPage)
           testGroupsPage.addAction(testGroupToTest, expectedImsBonusEntity.getAction());
   imsBonusPage.setAllFields(expectedImsBonusEntity);
   testGroupsPage = (TestGroupsPage) imsBonusPage.clickOk(true);
   campaignDetailsPage = testGroupsPage.clickSave();
   activityTab = campaignDetailsPage.openActivityTab();
   testGroupsPage = activityTab.clickActionsWithTestGroups();
   // THEN
   assertEquals(expectedImsBonusEntity.getAction(), testGroupsPage.getAction(testGroupToTest));
   assertEquals(
       expectedImsBonusEntity.getSelectedTemplateName()
           + " - Amount Source: "
           + expectedImsBonusEntity.getSourceForBonusCalcAmount(),
       testGroupsPage.getSummary(testGroupToTest));
   activityTab = campaignTabs.openActivityTab();
   testGroupsPage = activityTab.clickActionsWithTestGroups();
   imsBonusPage = (ImsBonusPage) testGroupsPage.clickEdit(testGroupToTest);
   actualImsBonusEntity = imsBonusPage.getAllFields();
   assertObjectsEquals(expectedImsBonusEntity, actualImsBonusEntity);
 }
 @BeforeMethod
 public void createNewCampaign() {
   // GIVEN
   DbUnitUtil.clean("demodb-jdbc.properties");
   campaignData = new CampaignData();
   cmDashboardPage = goToCMDashboardDirectly();
   campaignDetailsPage = cmDashboardPage.createCampaign(campaignData);
   campaignTabs = campaignDetailsPage.clickSave();
   activityTab = campaignTabs.openActivityTab();
   activityName = activityTab.getOpenedDetails().getActivityName();
   activityID = activityTab.getOpenedDetails().getActivityID();
   actionsPage = activityTab.clickActions();
   testGroupsPage = actionsPage.clickTestYes();
   expectedImsBonusEntity = new ImsBonusEntity();
   actualImsBonusEntity = new ImsBonusEntity();
 }
 @Test
 public void clickCancelTest() {
   expectedImsBonusEntity.setSelectedTemplateName(existingTemplate);
   expectedImsBonusEntity.setAvailableTemplates(new ArrayList<String>());
   // WHEN
   imsBonusPage =
       (ImsBonusPage)
           testGroupsPage.addAction(testGroupToTest, expectedImsBonusEntity.getAction());
   imsBonusPage.selectBonusTemplate(expectedImsBonusEntity.getSelectedTemplateName());
   testGroupsPage = (TestGroupsPage) imsBonusPage.clickCancel(true);
   // THEN
   assertTrue(
       testGroupsPage.getAction(testGroupToTest).equals("Add Action"),
       "IMS Bonus is in the Actions table after pressing Cancel button on IMS Bonus form.");
   campaignDetailsPage = testGroupsPage.clickSave();
   activityTab = campaignTabs.openActivityTab();
   testGroupsPage = activityTab.clickActionsWithTestGroups();
   assertTrue(
       testGroupsPage.getAction(testGroupToTest).equals("Add Action"),
       "IMS Bonus is in the Actions table after pressing Cancel button on IMS Bonus form and saving Campaign.");
 }