@Test public void shouldFindCampaignsByName() { CampaignRecord campaign = createCampaignRecord(); CampaignRecord campaign2 = createCampaignRecord(); campaign2.setName("Different Name"); campaignRecordService.create(campaign); campaignRecordService.create(campaign2); assertEquals(campaign, campaignRecordService.findByName("CampaignName")); assertEquals(campaign2, campaignRecordService.findByName("Different Name")); campaignRecordService.delete(campaign); campaignRecordService.delete(campaign2); }
@Test public void shouldDeleteCampaignRecords() { CampaignRecord campaign = createCampaignRecord(); campaignRecordService.create(campaign); assertEquals(campaign, campaignRecordService.findByName(campaign.getName())); campaignRecordService.delete(campaign); assertNull(campaignRecordService.findByName(campaign.getName())); }
@Test public void shouldUpdateRecord() { CampaignRecord campaign = createCampaignRecord(); CampaignRecord campaign2 = createCampaignRecord(); // add campaignRecordService.create(campaign); assertEquals(campaign, campaignRecordService.findByName(campaign.getName())); // update campaign2.setMaxDuration("20 week"); campaign.updateFrom(campaign2); campaign = campaignRecordService.update(campaign); assertEquals( campaign.getMaxDuration(), campaignRecordService.findByName(campaign.getName()).getMaxDuration()); campaignRecordService.delete(campaign); }