[26] | 1 | package geniusweb.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 tudelft.utilities.junit.GeneralTests;
|
---|
| 11 |
|
---|
| 12 | public class PartyIdTest extends GeneralTests<PartyId> {
|
---|
| 13 | private final PartyId id = new PartyId("party1");
|
---|
| 14 | private final PartyId id1 = new PartyId("party1");
|
---|
| 15 | private final PartyId idb = new PartyId("party2");
|
---|
| 16 |
|
---|
| 17 | @Override
|
---|
| 18 | public List<List<PartyId>> getGeneralTestData() {
|
---|
| 19 | return Arrays.asList(Arrays.asList(id, id1), Arrays.asList(idb));
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | @Override
|
---|
| 23 | public List<String> getGeneralTestStrings() {
|
---|
| 24 | return Arrays.asList("party1", "party2");
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | @SuppressWarnings("unused")
|
---|
| 28 | @Test(expected = IllegalArgumentException.class)
|
---|
| 29 | public void testRestrictions() {
|
---|
| 30 | new PartyId("");
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | @SuppressWarnings("unused")
|
---|
| 34 | @Test(expected = IllegalArgumentException.class)
|
---|
| 35 | public void testRestrictions2() {
|
---|
| 36 | new PartyId("@2");
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | @SuppressWarnings("unused")
|
---|
| 40 | @Test(expected = IllegalArgumentException.class)
|
---|
| 41 | public void testRestrictions3() {
|
---|
| 42 | new PartyId("_12");
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | @SuppressWarnings("unused")
|
---|
| 46 | @Test(expected = IllegalArgumentException.class)
|
---|
| 47 | public void testRestrictions4() {
|
---|
| 48 | new PartyId("12A");
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | @SuppressWarnings("unused")
|
---|
| 52 | @Test(expected = IllegalArgumentException.class)
|
---|
| 53 | public void testRestrictions5() {
|
---|
| 54 | new PartyId(" fds ");
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | @Test
|
---|
| 58 | public void testGetName() {
|
---|
| 59 | assertEquals("party1", id.getName());
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | @SuppressWarnings("unused")
|
---|
| 63 | @Test
|
---|
| 64 | public void testRestrictions6() {
|
---|
| 65 | new PartyId("A_1_23_ok");
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | @SuppressWarnings("unused")
|
---|
| 69 | @Test
|
---|
| 70 | public void testRestrictions7() {
|
---|
| 71 | new PartyId("a_1_23_ok");
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | }
|
---|