Ignore:
Timestamp:
10/08/20 10:17:25 (4 years ago)
Author:
bart
Message:

MOPAC support for timedependentparty, boulware, conceder, hardliner, linear

File:
1 edited

Legend:

Unmodified
Added
Removed
  • exampleparties/randomparty/src/test/java/geniusweb/exampleparties/randomparty/RandomPartyTest.java

    r24 r25  
    77import static org.mockito.Matchers.eq;
    88import static org.mockito.Mockito.mock;
     9import static org.mockito.Mockito.times;
    910import static org.mockito.Mockito.verify;
    1011import static org.mockito.Mockito.when;
     
    4243import geniusweb.inform.Finished;
    4344import geniusweb.inform.Inform;
     45import geniusweb.inform.OptIn;
    4446import geniusweb.inform.Settings;
    4547import geniusweb.inform.Voting;
     
    6870        private final TestConnection connection = new TestConnection();
    6971        private final ProtocolRef protocol = new ProtocolRef(SAOP);
     72        private final ProtocolRef mopacProtocol = new ProtocolRef("MOPAC");
    7073        private final ProgressRounds progress = mock(ProgressRounds.class);
    71         private Settings settings;
     74        private Settings settings, mopacSettings;
    7275        private LinearAdditive profile;
    7376        private final Parameters parameters = new Parameters();
     
    8083                                new ProfileRef(new URI("file:" + PROFILE)), protocol, progress,
    8184                                parameters);
     85                mopacSettings = new Settings(PARTY1,
     86                                new ProfileRef(new URI("file:" + PROFILE)), mopacProtocol,
     87                                progress, parameters);
    8288
    8389                String serialized = new String(Files.readAllBytes(Paths.get(PROFILE)),
     
    174180
    175181        @Test
    176         public void testAgentsUpdatesProgress() {
     182        public void testAgentsUpdatesSAOPProgress() {
    177183                party.connect(connection);
    178184                party.notifyChange(settings);
     
    180186                party.notifyChange(new YourTurn());
    181187                verify(progress).advance();
     188        }
     189
     190        @Test
     191        public void testAgentsUpdatesMOPACProgress() {
     192                party.connect(connection);
     193                party.notifyChange(mopacSettings);
     194                // in mopac, progress happens only after optin phase
     195                party.notifyChange(new YourTurn());
     196                verify(progress, times(0)).advance();
     197                party.notifyChange(
     198                                new Voting(Collections.emptyList(), Collections.emptyMap()));
     199                verify(progress, times(0)).advance();
     200                party.notifyChange(new OptIn(Collections.emptyList()));
     201                verify(progress, times(1)).advance();
    182202        }
    183203
     
    199219
    200220        @Test
    201         public void testVoting() {
    202                 party.connect(connection);
    203                 party.notifyChange(settings);
     221        public void testVoting() throws URISyntaxException {
     222                party.connect(connection);
     223                party.notifyChange(mopacSettings);
    204224
    205225                Bid bid = findGoodBid();
Note: See TracChangeset for help on using the changeset viewer.