Changeset 21 for exampleparties/randomparty/src/test/java/geniusweb
- Timestamp:
- 09/22/20 08:52:04 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
exampleparties/randomparty/src/test/java/geniusweb/exampleparties/randomparty/RandomPartyTest.java
r10 r21 16 16 import java.nio.file.Files; 17 17 import java.nio.file.Paths; 18 import java.util.Arrays; 19 import java.util.Collections; 18 20 import java.util.LinkedList; 19 21 import java.util.List; … … 32 34 import geniusweb.actions.Offer; 33 35 import geniusweb.actions.PartyId; 36 import geniusweb.actions.Votes; 34 37 import geniusweb.bidspace.AllBidsList; 35 38 import geniusweb.connection.ConnectionEnd; 39 import geniusweb.inform.ActionDone; 40 import geniusweb.inform.Finished; 41 import geniusweb.inform.Inform; 42 import geniusweb.inform.Settings; 43 import geniusweb.inform.Voting; 44 import geniusweb.inform.YourTurn; 36 45 import geniusweb.issuevalue.Bid; 37 46 import geniusweb.party.Capabilities; 38 import geniusweb.party.inform.ActionDone;39 import geniusweb.party.inform.Finished;40 import geniusweb.party.inform.Inform;41 import geniusweb.party.inform.Settings;42 import geniusweb.party.inform.YourTurn;43 47 import geniusweb.profile.Profile; 44 48 import geniusweb.profile.utilityspace.LinearAdditive; … … 53 57 public class RandomPartyTest { 54 58 59 private static final PartyId PARTY1 = new PartyId("party1"); 55 60 private static final String SAOP = "SAOP"; 56 61 private static final PartyId otherparty = new PartyId("other"); … … 60 65 private RandomParty party; 61 66 private final TestConnection connection = new TestConnection(); 62 private final ProtocolRef protocol = mock(ProtocolRef.class);67 private final ProtocolRef protocol = new ProtocolRef(SAOP); 63 68 private final ProgressRounds progress = mock(ProgressRounds.class); 64 69 private Settings settings; … … 70 75 IOException, URISyntaxException { 71 76 party = new RandomParty(); 72 settings = new Settings( new PartyId("party1"),77 settings = new Settings(PARTY1, 73 78 new ProfileRef(new URI("file:" + PROFILE)), protocol, progress, 74 79 parameters); … … 189 194 } 190 195 196 @Test 197 public void testVoting() { 198 party.connect(connection); 199 party.notifyChange(settings); 200 201 Bid bid = findGoodBid(); 202 party.notifyChange(new Voting(Arrays.asList(bid), 203 Collections.singletonMap(PARTY1, 1))); 204 assertEquals(1, connection.getActions().size()); 205 Action action = connection.getActions().get(0); 206 assertTrue(action instanceof Votes); 207 assertEquals(1, ((Votes) action).getVotes().size()); 208 assertEquals(bid, ((Votes) action).getVotes().get(0).getBid()); 209 } 210 191 211 } 192 212
Note:
See TracChangeset
for help on using the changeset viewer.