source: events/src/test/java/actions/PartyIdTest.java@ 20

Last change on this file since 20 was 1, checked in by bart, 5 years ago

Initial Release

File size: 1.4 KB
Line 
1package actions;
2
3import static org.junit.Assert.assertEquals;
4
5import java.util.Arrays;
6import java.util.List;
7
8import org.junit.Test;
9
10import geniusweb.actions.PartyId;
11import tudelft.utilities.junit.GeneralTests;
12
13public class PartyIdTest extends GeneralTests<PartyId> {
14 private final PartyId id = new PartyId("party1");
15 private final PartyId id1 = new PartyId("party1");
16 private final PartyId idb = new PartyId("party2");
17
18 @Override
19 public List<List<PartyId>> getGeneralTestData() {
20 return Arrays.asList(Arrays.asList(id, id1), Arrays.asList(idb));
21 }
22
23 @Override
24 public List<String> getGeneralTestStrings() {
25 return Arrays.asList("party1", "party2");
26 }
27
28 @Test(expected = IllegalArgumentException.class)
29 public void testRestrictions() {
30 new PartyId("");
31 }
32
33 @Test(expected = IllegalArgumentException.class)
34 public void testRestrictions2() {
35 new PartyId("@2");
36 }
37
38 @Test(expected = IllegalArgumentException.class)
39 public void testRestrictions3() {
40 new PartyId("_12");
41 }
42
43 @Test(expected = IllegalArgumentException.class)
44 public void testRestrictions4() {
45 new PartyId("12A");
46 }
47
48 @Test(expected = IllegalArgumentException.class)
49 public void testRestrictions5() {
50 new PartyId(" fds ");
51 }
52
53 @Test
54 public void testGetName() {
55 assertEquals("party1", id.getName());
56 }
57
58 @Test
59 public void testRestrictions6() {
60 new PartyId("A_1_23_ok");
61 }
62
63 @Test
64 public void testRestrictions7() {
65 new PartyId("a_1_23_ok");
66 }
67
68}
Note: See TracBrowser for help on using the repository browser.