Ignore:
Timestamp:
01/28/20 10:19:54 (4 years ago)
Author:
bart
Message:

Update 28 jan 2020

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocol/src/test/java/geniusweb/protocol/session/saop/SAOPStateTest.java

    r9 r10  
    2727import geniusweb.progress.ProgressTime;
    2828import geniusweb.protocol.ProtocolException;
     29import geniusweb.protocol.partyconnection.ProtocolToPartyConn;
    2930import geniusweb.protocol.partyconnection.ProtocolToPartyConnections;
    30 import geniusweb.protocol.partyconnection.ProtocolToPartyConn;
    3131import geniusweb.protocol.session.SessionSettings;
    3232import tudelft.utilities.junit.GeneralTests;
     
    220220        }
    221221
    222         @Test
     222        @Test(expected = IllegalArgumentException.class)
    223223        public void withWrongActionTest() {
    224224                // wrong because action has actor null which does not match party1
    225225                SAOPState state = state1.with(party1, action);
    226                 assertEquals(1, state.getActions().size());
    227                 assertEquals(action, state.getActions().get(0));
    228                 assertTrue(state.isFinal(NOW));
    229                 assertEquals(
    230                                 "geniusweb.protocol.ProtocolException: party1:act contains wrong credentials: act1",
    231                                 state.getError().toString());
    232         }
    233 
    234         @Test
     226//              assertEquals(1, state.getActions().size());
     227//              assertEquals(action, state.getActions().get(0));
     228//              assertTrue(state.isFinal(NOW));
     229        }
     230
     231        @Test(expected = IllegalArgumentException.class)
    235232        public void withActionTest() {
    236233                when(action.getActor()).thenReturn(party1);
    237                 SAOPState state = state1.with(party1, action);
    238                 assertEquals(1, state.getActions().size());
    239                 assertEquals(action, state.getActions().get(0));
     234                state1.with(party1, action);
    240235        }
    241236
     
    265260        }
    266261
    267         @Test
     262        @Test(expected = IllegalArgumentException.class)
    268263        public void RefuseImmediateAccept() {
    269264                Accept nullaccept = new Accept(party1, null);
    270265                SAOPState state = state1.with(party1, nullaccept);
    271                 assertTrue(state.isFinal(NOW));
    272                 assertEquals(
    273                                 "geniusweb.protocol.ProtocolException: party1:Accept without a recent offer",
    274                                 state.getError().toString());
    275         }
    276 
    277         @Test
     266        }
     267
     268        @Test(expected = IllegalArgumentException.class)
    278269        public void RefuseNotMyTurn() {
    279270                List<Action> actions = Arrays.asList(offer1);
     
    281272                                settings, null, null);
    282273
    283                 state = state.with(party1, offer1);
    284                 assertTrue(state.isFinal(NOW));
    285                 assertEquals(
    286                                 "geniusweb.protocol.ProtocolException: party1:Party does not have the turn ",
    287                                 state.getError().toString());
    288         }
    289 
    290         @Test
     274                state.with(party1, offer1);
     275//              assertTrue(state.isFinal(NOW));
     276//              assertEquals(
     277//                              "geniusweb.protocol.ProtocolException: party1:Party does not have the turn ",
     278//                              state.getError().toString());
     279        }
     280
     281        @Test(expected = IllegalArgumentException.class)
    291282        public void RefuseNullAccept() {
    292283                List<Action> actions = Arrays.asList(offer1);
     
    297288                state = state.with(party2, nullaccept);
    298289                assertTrue(state.isFinal(NOW));
    299                 assertTrue(state.getError().toString().matches(
    300                                 ".*party2.*Party accepts a bid differing from the last offer.*"));
    301         }
    302 
    303         @Test
     290        }
     291
     292        @Test(expected = IllegalArgumentException.class)
    304293        public void RefuseNullAction() {
    305294                List<Action> actions = Arrays.asList(offer1);
     
    308297
    309298                state = state.with(party2, null);
    310                 assertEquals(
    311                                 "geniusweb.protocol.ProtocolException: party2:action is null",
    312                                 state.getError().toString());
    313299        }
    314300
Note: See TracChangeset for help on using the changeset viewer.