1 | package actions;
|
---|
2 |
|
---|
3 | import static org.junit.Assert.assertEquals;
|
---|
4 |
|
---|
5 | import java.util.Arrays;
|
---|
6 | import java.util.List;
|
---|
7 |
|
---|
8 | import org.junit.Test;
|
---|
9 |
|
---|
10 | import geniusweb.actions.PartyId;
|
---|
11 | import tudelft.utilities.junit.GeneralTests;
|
---|
12 |
|
---|
13 | public 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 | @SuppressWarnings("unused")
|
---|
29 | @Test(expected = IllegalArgumentException.class)
|
---|
30 | public void testRestrictions() {
|
---|
31 | new PartyId("");
|
---|
32 | }
|
---|
33 |
|
---|
34 | @SuppressWarnings("unused")
|
---|
35 | @Test(expected = IllegalArgumentException.class)
|
---|
36 | public void testRestrictions2() {
|
---|
37 | new PartyId("@2");
|
---|
38 | }
|
---|
39 |
|
---|
40 | @SuppressWarnings("unused")
|
---|
41 | @Test(expected = IllegalArgumentException.class)
|
---|
42 | public void testRestrictions3() {
|
---|
43 | new PartyId("_12");
|
---|
44 | }
|
---|
45 |
|
---|
46 | @SuppressWarnings("unused")
|
---|
47 | @Test(expected = IllegalArgumentException.class)
|
---|
48 | public void testRestrictions4() {
|
---|
49 | new PartyId("12A");
|
---|
50 | }
|
---|
51 |
|
---|
52 | @SuppressWarnings("unused")
|
---|
53 | @Test(expected = IllegalArgumentException.class)
|
---|
54 | public void testRestrictions5() {
|
---|
55 | new PartyId(" fds ");
|
---|
56 | }
|
---|
57 |
|
---|
58 | @Test
|
---|
59 | public void testGetName() {
|
---|
60 | assertEquals("party1", id.getName());
|
---|
61 | }
|
---|
62 |
|
---|
63 | @SuppressWarnings("unused")
|
---|
64 | @Test
|
---|
65 | public void testRestrictions6() {
|
---|
66 | new PartyId("A_1_23_ok");
|
---|
67 | }
|
---|
68 |
|
---|
69 | @SuppressWarnings("unused")
|
---|
70 | @Test
|
---|
71 | public void testRestrictions7() {
|
---|
72 | new PartyId("a_1_23_ok");
|
---|
73 | }
|
---|
74 |
|
---|
75 | }
|
---|