Changeset 22 for events/src/test


Ignore:
Timestamp:
09/22/20 16:26:36 (4 years ago)
Author:
bart
Message:

Minor fixes

Location:
events/src/test/java/actions
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • events/src/test/java/actions/PartyIdTest.java

    r1 r22  
    2626        }
    2727
     28        @SuppressWarnings("unused")
    2829        @Test(expected = IllegalArgumentException.class)
    2930        public void testRestrictions() {
     
    3132        }
    3233
     34        @SuppressWarnings("unused")
    3335        @Test(expected = IllegalArgumentException.class)
    3436        public void testRestrictions2() {
     
    3638        }
    3739
     40        @SuppressWarnings("unused")
    3841        @Test(expected = IllegalArgumentException.class)
    3942        public void testRestrictions3() {
     
    4144        }
    4245
     46        @SuppressWarnings("unused")
    4347        @Test(expected = IllegalArgumentException.class)
    4448        public void testRestrictions4() {
     
    4650        }
    4751
     52        @SuppressWarnings("unused")
    4853        @Test(expected = IllegalArgumentException.class)
    4954        public void testRestrictions5() {
     
    5661        }
    5762
     63        @SuppressWarnings("unused")
    5864        @Test
    5965        public void testRestrictions6() {
     
    6167        }
    6268
     69        @SuppressWarnings("unused")
    6370        @Test
    6471        public void testRestrictions7() {
  • events/src/test/java/actions/PartyIdTest1.java

    r1 r22  
    4343        }
    4444
     45        @SuppressWarnings("unused")
    4546        @Test(expected = IllegalArgumentException.class)
    4647        public void smokeTest() throws URISyntaxException {
     
    4849        }
    4950
     51        @SuppressWarnings("unused")
    5052        @Test(expected = IllegalArgumentException.class)
    5153        public void nullTest() throws URISyntaxException {
  • events/src/test/java/actions/VoteTest.java

    r21 r22  
    66import java.util.Arrays;
    77import java.util.HashMap;
    8 import java.util.LinkedList;
    98import java.util.List;
    109import java.util.Map;
     
    3938        private final static Value VALUE2 = new NumberValue("10");
    4039        // 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}}";
    4241
    43         private static Vote vote1, vote1a, vote2, vote3, vote4;
     42        private static Vote vote1, vote1a, vote2, vote3, vote4, vote5;
    4443
    4544        static {
     
    4746                issuevalues.put(ISSUE2, VALUE2);
    4847                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);
    5150
    52                 vote2 = new Vote(id2, bid, 1);
     51                vote2 = new Vote(id2, bid, 1, 2);
    5352
    5453                // values swapped, so different issuevalues.
     
    5655                issuevaluesb.put(ISSUE2, VALUE2);
    5756                bidb = new Bid(issuevaluesb);
    58                 vote3 = new Vote(id, bidb, 1);
     57                vote3 = new Vote(id, bidb, 1, 2);
    5958
    60                 vote4 = new Vote(id, bid, 2);
     59                vote4 = new Vote(id, bid, 2, 2);
     60                vote5 = new Vote(id, bid, 1, 3);
    6161
    6262        }
     
    6464        @Override
    6565        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));
    7269        }
    7370
    7471        @Override
    7572        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.*");
    8078        }
    8179
  • events/src/test/java/actions/VotesTest.java

    r21 r22  
    2424public class VotesTest extends GeneralTests<Votes> {
    2525        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}}]}}";
    2727
    2828        private PartyId partyA = new PartyId("partyA");
     
    3030        private Bid bid1 = new Bid("is1", new DiscreteValue("val1")),
    3131                        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);
    3636
    3737        private Votes votes1 = new Votes(partyA, Arrays.asList(voteA1, voteA2));
     
    9595        @Test
    9696        public void isExtendingTestLessPower() {
    97                 Vote powervoteA1 = new Vote(partyA, bid1, 3);
     97                Vote powervoteA1 = new Vote(partyA, bid1, 3, 9);
    9898                Votes powerVotes = new Votes(partyA, Arrays.asList(powervoteA1));
    9999                assertFalse(powerVotes.isExtending(votes1));
     
    103103        @Test(expected = IllegalArgumentException.class)
    104104        public void testDuplicateBidsNotAllowed() {
    105                 Vote voteA1similar = new Vote(partyA, bid1, 3);
     105                Vote voteA1similar = new Vote(partyA, bid1, 3, 9);
    106106                Votes votes = new Votes(partyA, Arrays.asList(voteA1, voteA1similar));
    107107        }
Note: See TracChangeset for help on using the changeset viewer.