コード例 #1
0
  @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);
  }
コード例 #2
0
  private CampaignRecord createCampaignRecord() {
    CampaignRecord campaign = new CampaignRecord();
    campaign.setCampaignType(CampaignType.ABSOLUTE);
    campaign.setMaxDuration("10 week");
    campaign.setName("CampaignName");

    CampaignMessageRecord message = new CampaignMessageRecord();
    message.setDate(LocalDate.now());
    message.setMessageType(CampaignType.ABSOLUTE);
    message.setStartTime("20:44");
    message.setMessageKey("key");
    message.setLanguages(new ArrayList<>(asList("lang1", "lang2", "lang3")));

    campaign.setMessages(new ArrayList<>(asList(message)));

    return campaign;
  }