Changeset 22 for events/src/test
- Timestamp:
- 09/22/20 16:26:36 (4 years ago)
- Location:
- events/src/test/java/actions
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
events/src/test/java/actions/PartyIdTest.java
r1 r22 26 26 } 27 27 28 @SuppressWarnings("unused") 28 29 @Test(expected = IllegalArgumentException.class) 29 30 public void testRestrictions() { … … 31 32 } 32 33 34 @SuppressWarnings("unused") 33 35 @Test(expected = IllegalArgumentException.class) 34 36 public void testRestrictions2() { … … 36 38 } 37 39 40 @SuppressWarnings("unused") 38 41 @Test(expected = IllegalArgumentException.class) 39 42 public void testRestrictions3() { … … 41 44 } 42 45 46 @SuppressWarnings("unused") 43 47 @Test(expected = IllegalArgumentException.class) 44 48 public void testRestrictions4() { … … 46 50 } 47 51 52 @SuppressWarnings("unused") 48 53 @Test(expected = IllegalArgumentException.class) 49 54 public void testRestrictions5() { … … 56 61 } 57 62 63 @SuppressWarnings("unused") 58 64 @Test 59 65 public void testRestrictions6() { … … 61 67 } 62 68 69 @SuppressWarnings("unused") 63 70 @Test 64 71 public void testRestrictions7() { -
events/src/test/java/actions/PartyIdTest1.java
r1 r22 43 43 } 44 44 45 @SuppressWarnings("unused") 45 46 @Test(expected = IllegalArgumentException.class) 46 47 public void smokeTest() throws URISyntaxException { … … 48 49 } 49 50 51 @SuppressWarnings("unused") 50 52 @Test(expected = IllegalArgumentException.class) 51 53 public void nullTest() throws URISyntaxException { -
events/src/test/java/actions/VoteTest.java
r21 r22 6 6 import java.util.Arrays; 7 7 import java.util.HashMap; 8 import java.util.LinkedList;9 8 import java.util.List; 10 9 import java.util.Map; … … 39 38 private final static Value VALUE2 = new NumberValue("10"); 40 39 // issue 2 is NUMBER and thus serializes with leading '=' 41 private final String votestring = "{\"vote\":{\"actor\":\"party1\",\"bid\":{\"issuevalues\":{\"issue2\":10,\"issue1\":\"value1\"}},\"minPower\":1 }}";40 private final String votestring = "{\"vote\":{\"actor\":\"party1\",\"bid\":{\"issuevalues\":{\"issue2\":10,\"issue1\":\"value1\"}},\"minPower\":1,\"maxPower\":2}}"; 42 41 43 private static Vote vote1, vote1a, vote2, vote3, vote4 ;42 private static Vote vote1, vote1a, vote2, vote3, vote4, vote5; 44 43 45 44 static { … … 47 46 issuevalues.put(ISSUE2, VALUE2); 48 47 bid = new Bid(issuevalues); 49 vote1 = new Vote(id, bid, 1 );50 vote1a = new Vote(id, bid, 1 );48 vote1 = new Vote(id, bid, 1, 2); 49 vote1a = new Vote(id, bid, 1, 2); 51 50 52 vote2 = new Vote(id2, bid, 1 );51 vote2 = new Vote(id2, bid, 1, 2); 53 52 54 53 // values swapped, so different issuevalues. … … 56 55 issuevaluesb.put(ISSUE2, VALUE2); 57 56 bidb = new Bid(issuevaluesb); 58 vote3 = new Vote(id, bidb, 1 );57 vote3 = new Vote(id, bidb, 1, 2); 59 58 60 vote4 = new Vote(id, bid, 2); 59 vote4 = new Vote(id, bid, 2, 2); 60 vote5 = new Vote(id, bid, 1, 3); 61 61 62 62 } … … 64 64 @Override 65 65 public List<List<Vote>> getGeneralTestData() { 66 List<List<Vote>> list = new LinkedList<>(); 67 list.add(Arrays.asList(vote1, vote1a)); 68 list.add(Arrays.asList(vote2)); 69 list.add(Arrays.asList(vote3)); 70 list.add(Arrays.asList(vote4)); 71 return list; 66 return Arrays.asList(Arrays.asList(vote1, vote1a), Arrays.asList(vote2), 67 Arrays.asList(vote3), Arrays.asList(vote4), 68 Arrays.asList(vote5)); 72 69 } 73 70 74 71 @Override 75 72 public List<String> getGeneralTestStrings() { 76 return Arrays.asList("Vote.*party1.*issue2=10.*issue1=.value1.*1.*", 77 "Vote.*party2.*issue2=10.*issue1=.value1.*1.*", 78 "Vote.*party1.*issue2=10.*issue1=10.*1.*", 79 "Vote.*party1.*issue2=10.*issue1=.value1.*2.*"); 73 return Arrays.asList("Vote.*party1.*issue2=10.*issue1=.value1.*1.*2.*", 74 "Vote.*party2.*issue2=10.*issue1=.value1.*1.*2.*", 75 "Vote.*party1.*issue2=10.*issue1=10.*1.*2.*", 76 "Vote.*party1.*issue2=10.*issue1=.value1.*2.*2.*", 77 "Vote.*party1.*issue2=10.*issue1=.value1.*1.*3.*"); 80 78 } 81 79 -
events/src/test/java/actions/VotesTest.java
r21 r22 24 24 public class VotesTest extends GeneralTests<Votes> { 25 25 private final ObjectMapper jackson = new ObjectMapper(); 26 private final String votestring = "{\"Votes\":{\"actor\":\"partyA\",\"votes\":[{\"vote\":{\"actor\":\"partyA\",\"bid\":{\"issuevalues\":{\"is1\":\"val1\"}},\"minPower\":2 }},{\"vote\":{\"actor\":\"partyA\",\"bid\":{\"issuevalues\":{\"is1\":\"val2\"}},\"minPower\":2}}]}}";26 private final String votestring = "{\"Votes\":{\"actor\":\"partyA\",\"votes\":[{\"vote\":{\"actor\":\"partyA\",\"bid\":{\"issuevalues\":{\"is1\":\"val1\"}},\"minPower\":2,\"maxPower\":9}},{\"vote\":{\"actor\":\"partyA\",\"bid\":{\"issuevalues\":{\"is1\":\"val2\"}},\"minPower\":2,\"maxPower\":9}}]}}"; 27 27 28 28 private PartyId partyA = new PartyId("partyA"); … … 30 30 private Bid bid1 = new Bid("is1", new DiscreteValue("val1")), 31 31 bid2 = new Bid("is1", new DiscreteValue("val2")); 32 private Vote voteA1 = new Vote(partyA, bid1, 2 );33 private Vote voteA2 = new Vote(partyA, bid2, 2 );34 private Vote voteB1 = new Vote(partyB, bid1, 2 );35 private Vote voteB2 = new Vote(partyB, bid2, 2 );32 private Vote voteA1 = new Vote(partyA, bid1, 2, 9); 33 private Vote voteA2 = new Vote(partyA, bid2, 2, 9); 34 private Vote voteB1 = new Vote(partyB, bid1, 2, 9); 35 private Vote voteB2 = new Vote(partyB, bid2, 2, 9); 36 36 37 37 private Votes votes1 = new Votes(partyA, Arrays.asList(voteA1, voteA2)); … … 95 95 @Test 96 96 public void isExtendingTestLessPower() { 97 Vote powervoteA1 = new Vote(partyA, bid1, 3 );97 Vote powervoteA1 = new Vote(partyA, bid1, 3, 9); 98 98 Votes powerVotes = new Votes(partyA, Arrays.asList(powervoteA1)); 99 99 assertFalse(powerVotes.isExtending(votes1)); … … 103 103 @Test(expected = IllegalArgumentException.class) 104 104 public void testDuplicateBidsNotAllowed() { 105 Vote voteA1similar = new Vote(partyA, bid1, 3 );105 Vote voteA1similar = new Vote(partyA, bid1, 3, 9); 106 106 Votes votes = new Votes(partyA, Arrays.asList(voteA1, voteA1similar)); 107 107 }
Note:
See TracChangeset
for help on using the changeset viewer.