Esempio n. 1
0
  @Test
  public void test_poll_setWebsite_exception_noCampaign() {
    // GIVEN
    Poll sond = new Poll();
    String url = "Blajefe.monsite.fr";
    // WHEN

    // THEN
    try {
      sond.setWebsite(url);
      fail("Website URL should be correct to the pattern.");
    } catch (IllegalArgumentException expected) {
      assertEquals("Website URL should be correct to the pattern.", expected.getMessage());
    }
  }
Esempio n. 2
0
 @Test
 public void test_poll_setWebsite_noCampaign3() {
   // GIVEN
   Poll sond = new Poll();
   String url = "https://www.google.fr/search?client=ubuntu";
   // WHEN
   sond.setWebsite(url);
   // THEN
   assertEquals(sond.getWebsite(), url);
   /*try {
       sond.setWebsite(url);
       fail("Website URL should be correct to the pattern.");
   } catch (IllegalArgumentException expected) {
       assertEquals("Website URL should be correct to the pattern.", expected.getMessage());
   }*/
 }
Esempio n. 3
0
 @Test
 public void test_poll_setWebsite_noCampaign2() {
   // GIVEN
   Poll sond = new Poll();
   String url = "http://aaaaaaaaaa";
   // WHEN
   // sond.setWebsite(url);
   // THEN
   // assertEquals(sond.getWebsite(), url);
   try {
     sond.setWebsite(url);
     fail("Website URL should be correct to the pattern.");
   } catch (IllegalArgumentException expected) {
     assertEquals("Website URL should be correct to the pattern.", expected.getMessage());
   }
 }
Esempio n. 4
0
  @Test
  public void test_poll_setWebsite_noCampaign4() {
    // GIVEN
    Poll sond = new Poll();
    String url = "http://communaute-universitaire.univ-rouen.fr/";
    // WHEN
    sond.setWebsite(url);
    // THEN
    assertEquals(sond.getWebsite(), url);
    /*try {
        sond.setWebsite(url);
        fail("Website URL should be correct to the pattern.");
    } catch (IllegalArgumentException expected) {
        assertEquals("Website URL should be correct to the pattern.", expected.getMessage());
    }*/

  }
Esempio n. 5
0
 @Test
 public void test_poll_setWebsite_exception_Campaign() {
   // GIVEN
   Poll sond = new Poll();
   String url = "Blajefe.monsite.fr";
   // 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.setWebsite(url);
     fail("A campaign is processing.");
   } catch (IllegalArgumentException expected) {
     assertEquals("A campaign is processing.", expected.getMessage());
   }
 }