[1] | 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 |
|
---|
[22] | 28 | @SuppressWarnings("unused")
|
---|
[1] | 29 | @Test(expected = IllegalArgumentException.class)
|
---|
| 30 | public void testRestrictions() {
|
---|
| 31 | new PartyId("");
|
---|
| 32 | }
|
---|
| 33 |
|
---|
[22] | 34 | @SuppressWarnings("unused")
|
---|
[1] | 35 | @Test(expected = IllegalArgumentException.class)
|
---|
| 36 | public void testRestrictions2() {
|
---|
| 37 | new PartyId("@2");
|
---|
| 38 | }
|
---|
| 39 |
|
---|
[22] | 40 | @SuppressWarnings("unused")
|
---|
[1] | 41 | @Test(expected = IllegalArgumentException.class)
|
---|
| 42 | public void testRestrictions3() {
|
---|
| 43 | new PartyId("_12");
|
---|
| 44 | }
|
---|
| 45 |
|
---|
[22] | 46 | @SuppressWarnings("unused")
|
---|
[1] | 47 | @Test(expected = IllegalArgumentException.class)
|
---|
| 48 | public void testRestrictions4() {
|
---|
| 49 | new PartyId("12A");
|
---|
| 50 | }
|
---|
| 51 |
|
---|
[22] | 52 | @SuppressWarnings("unused")
|
---|
[1] | 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 |
|
---|
[22] | 63 | @SuppressWarnings("unused")
|
---|
[1] | 64 | @Test
|
---|
| 65 | public void testRestrictions6() {
|
---|
| 66 | new PartyId("A_1_23_ok");
|
---|
| 67 | }
|
---|
| 68 |
|
---|
[22] | 69 | @SuppressWarnings("unused")
|
---|
[1] | 70 | @Test
|
---|
| 71 | public void testRestrictions7() {
|
---|
| 72 | new PartyId("a_1_23_ok");
|
---|
| 73 | }
|
---|
| 74 |
|
---|
| 75 | }
|
---|