Exemple #1
0
 @Test
 public void test_poll_removeKey_Campaign() {
   // GIVEN
   Poll sond = new Poll();
   String key1 = "test";
   String key2 = "test2";
   List<String> keys = new ArrayList<String>();
   keys.add(key1);
   keys.add(key2);
   sond.setKeywords(keys);
   // WHEN
   Campaign c = new Campaign();
   c.setStartingAt(new Timestamp(new Date().getTime()));
   c.setEndingAt(new Timestamp(new Date().getTime() + 10000));
   List<Campaign> lcamps = new ArrayList<Campaign>();
   lcamps.add(c);
   sond.setCampaigns(lcamps);
   // THEN
   try {
     sond.removeKeyword("test");
     fail("A campaign is processing.");
   } catch (IllegalArgumentException expected) {
     assertEquals("A campaign is processing.", expected.getMessage());
   }
 }
Exemple #2
0
 @Test
 public void test_poll_setCampaign_noCampaign() {
   // GIVEN
   Poll sond = new Poll();
   List<Campaign> campList = new ArrayList<Campaign>();
   // WHEN
   sond.setCampaigns(campList);
   // THEN
   assertEquals(sond.getCampaigns(), campList);
 }
Exemple #3
0
 @Test
 public void test_poll_setCampaign_Campaign() {
   // GIVEN
   Poll sond = new Poll();
   List<Campaign> campList = new ArrayList<Campaign>();
   // WHEN
   Campaign c = new Campaign();
   c.setStartingAt(new Timestamp(new Date().getTime()));
   c.setEndingAt(new Timestamp(new Date().getTime() + 10000));
   List<Campaign> lcamps = new ArrayList<Campaign>();
   lcamps.add(c);
   sond.setCampaigns(lcamps);
   // THEN
   try {
     sond.setCampaigns(campList);
     fail("A campaign is processing.");
   } catch (IllegalArgumentException expected) {
     assertEquals("A campaign is processing.", expected.getMessage());
   }
 }
Exemple #4
0
 @Test
 public void test_poll_visible_poll() {
   // GIVEN
   Poll sond = new Poll();
   Campaign c = new Campaign();
   c.setVisibility(CampaignVisibility.PUBLIC);
   List<Campaign> camps = new ArrayList<Campaign>();
   camps.add(c);
   // WHEN
   sond.setCampaigns(camps);
   // THEN
   assertEquals(sond.getCampaigns().get(0).getVisibility(), CampaignVisibility.PUBLIC);
 }