コード例 #1
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;
  }
コード例 #2
0
  @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);
  }