Skip to main content
summaryrefslogtreecommitdiffstats
blob: cb25b308807798b1c2f95d56c4fe9b3673ee859d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * Created on Jun 6, 2011
 *
 * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
 */
package org.eclipse.osee.mail;

import java.util.ArrayList;
import java.util.Collection;
import junit.framework.Assert;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

/**
 * Test unit for {@link MailMessage} using only a 1-String parameter list.
 * 
 * @author Shawn F. cook
 */
@RunWith(Parameterized.class)
public class MailMessageSingleParamTest {
   String str_value;

   public MailMessageSingleParamTest(String str_value) {
      this.str_value = str_value;
   }

   @org.junit.Test
   public void testMailMsgSetFrom() {
      MailMessage msg = new MailMessage();
      msg.setFrom(str_value);
      Assert.assertEquals(str_value, msg.getFrom());
   }

   @org.junit.Test
   public void testMailMsgSetId() {
      MailMessage msg = new MailMessage();
      msg.setId(str_value);
      Assert.assertEquals(str_value, msg.getId());
   }

   @org.junit.Test
   public void testMailMsgSetSubject() {
      MailMessage msg = new MailMessage();
      msg.setSubject(str_value);
      Assert.assertEquals(str_value, msg.getSubject());
   }//test_MailMsg_accessors

   @Parameters
   public static Collection<Object[]> getData() {
      Collection<Object[]> data = new ArrayList<Object[]>();

      data.add(new Object[] {"One new string value."});
      data.add(new Object[] {"joe.schmoe@somedomain.com"});
      data.add(new Object[] {"Testing special characters - ~`!@#$%^&*()_-+={}|[]:\";'<>?,./"});

      //generate a very long string
      String aLongString = "";
      //make a 1000 char string.
      for (int i = 0; i < 1000; i++) {
         aLongString += "x";
      }
      data.add(new Object[] {aLongString});

      return data;
   }//getData
}

Back to the top