- Timestamp:
- 01/28/20 10:19:54 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocol/src/test/java/geniusweb/protocol/session/saop/SAOPStateTest.java
r9 r10 27 27 import geniusweb.progress.ProgressTime; 28 28 import geniusweb.protocol.ProtocolException; 29 import geniusweb.protocol.partyconnection.ProtocolToPartyConn; 29 30 import geniusweb.protocol.partyconnection.ProtocolToPartyConnections; 30 import geniusweb.protocol.partyconnection.ProtocolToPartyConn;31 31 import geniusweb.protocol.session.SessionSettings; 32 32 import tudelft.utilities.junit.GeneralTests; … … 220 220 } 221 221 222 @Test 222 @Test(expected = IllegalArgumentException.class) 223 223 public void withWrongActionTest() { 224 224 // wrong because action has actor null which does not match party1 225 225 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) 235 232 public void withActionTest() { 236 233 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); 240 235 } 241 236 … … 265 260 } 266 261 267 @Test 262 @Test(expected = IllegalArgumentException.class) 268 263 public void RefuseImmediateAccept() { 269 264 Accept nullaccept = new Accept(party1, null); 270 265 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) 278 269 public void RefuseNotMyTurn() { 279 270 List<Action> actions = Arrays.asList(offer1); … … 281 272 settings, null, null); 282 273 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) 291 282 public void RefuseNullAccept() { 292 283 List<Action> actions = Arrays.asList(offer1); … … 297 288 state = state.with(party2, nullaccept); 298 289 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) 304 293 public void RefuseNullAction() { 305 294 List<Action> actions = Arrays.asList(offer1); … … 308 297 309 298 state = state.with(party2, null); 310 assertEquals(311 "geniusweb.protocol.ProtocolException: party2:action is null",312 state.getError().toString());313 299 } 314 300
Note:
See TracChangeset
for help on using the changeset viewer.