Changeset 20 for protocol/src/test/java/geniusweb
- Timestamp:
- 08/05/20 09:42:15 (4 years ago)
- Location:
- protocol/src/test/java/geniusweb/protocol
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
protocol/src/test/java/geniusweb/protocol/session/DefaultSessionStateTest.java
r10 r20 139 139 } 140 140 141 @Override 142 public SessionResult getResult() { 143 144 List<Double> emptylist = new LinkedList<>(); 145 for (int n = 0; n < getConnections().size(); n++) 146 emptylist.add(0d); 147 return new SessionResult(getSettings().getAllParties(), getAgreement(), 148 emptylist, getError()); 149 150 } 151 141 152 } -
protocol/src/test/java/geniusweb/protocol/session/SessionResultTest.java
r8 r20 19 19 import geniusweb.issuevalue.DiscreteValue; 20 20 import geniusweb.issuevalue.Value; 21 import geniusweb.protocol.SessionResult;22 21 import geniusweb.references.Parameters; 23 22 import geniusweb.references.PartyRef; … … 32 31 33 32 private final String ISSUE1 = "issue1"; 34 private SessionResult result1, result1a, result2, result3 ;//, result4;33 private SessionResult result1, result1a, result2, result3, result4; 35 34 private String errorstring; // created dynamically: eclipse and maven 36 35 // generate different stacktrace. 37 private String jsonstring = "{\"participants\":[{\"party\":{\"partyref\":\"party1\",\"parameters\":{}},\"profile\":\"profile1\"},{\"party\":{\"partyref\":\"party2\",\"parameters\":{}},\"profile\":\"profile2\"}],\"agreement\":{\"issuevalues\":{\"issue1\":\"a\"}},\"error\":null}"; 36 private String jsonstring = "{\"participants\":[{\"party\":{\"partyref\":\"party1\",\"parameters\":{}},\"profile\":\"profile1\"},{\"party\":{\"partyref\":\"party2\",\"parameters\":{}},\"profile\":\"profile2\"}],\"agreement\":{\"issuevalues\":{\"issue1\":\"a\"}},\"penalties\":[0.0,0.0],\"error\":null}"; 37 private List<Double> nopenalties = Arrays.asList(0d, 0d); 38 private List<Double> penalties = Arrays.asList(0.1d, 0.2d); 38 39 39 40 @Before … … 63 64 64 65 result1 = new SessionResult(Arrays.asList(partyprofile1, partyprofile2), 65 bid1, n ull);66 bid1, nopenalties, null); 66 67 result1a = new SessionResult( 67 Arrays.asList(partyprofile1, partyprofile2), bid1, null); 68 Arrays.asList(partyprofile1, partyprofile2), bid1, nopenalties, 69 null); 68 70 result2 = new SessionResult(Arrays.asList(partyprofile1, partyprofile2), 69 bid2, n ull);71 bid2, nopenalties, null); 70 72 result3 = new SessionResult(Arrays.asList(partyprofile2, partyprofile1), 71 bid2, null); 73 bid2, nopenalties, null); 74 result4 = new SessionResult(Arrays.asList(partyprofile2, partyprofile1), 75 bid2, penalties, null); 76 72 77 // IGNORE ERROR for now, it fails somewhere deep in maven suddenly. 73 78 // result4 = new SessionResult(Arrays.asList(partyprofile1, … … 78 83 public List<List<SessionResult>> getGeneralTestData() { 79 84 return Arrays.asList(Arrays.asList(result1, result1a), 80 Arrays.asList(result2), Arrays.asList(result3) 81 // ,Arrays.asList(result4) 82 ); 85 Arrays.asList(result2), Arrays.asList(result3), 86 Arrays.asList(result4)); 83 87 } 84 88 … … 86 90 public List<String> getGeneralTestStrings() { 87 91 return Arrays.asList( 88 "SessionResult.*party1.*profile1.*,.*party2.*profile2.*Bid.*issue1=\"a\".* null.",89 "SessionResult.*party1.*profile1.*,.*party2.*profile2.*Bid.*issue1=\"b\".* null.*",90 "SessionResult.*party2.*profile2.*,.*party1.*profile1.*Bid.*issue1=\"b\".* null.*"91 // ,"SessionResult.*party1.*profile1.*,.*party2.*profile2.*Bid.*issue1=\"a\".*null.*"92 "SessionResult.*party1.*profile1.*,.*party2.*profile2.*Bid.*issue1=\"a\".*0\\.0.*0\\.0.*null.*", 93 "SessionResult.*party1.*profile1.*,.*party2.*profile2.*Bid.*issue1=\"b\".*0\\.0.*0\\.0.*null.*", 94 "SessionResult.*party2.*profile2.*,.*party1.*profile1.*Bid.*issue1=\"b\".*0\\.0.*0\\.0.*null.*", 95 "SessionResult.*party2.*profile2.*,.*party1.*profile1.*Bid.*issue1=\"b\".*0\\.1.*0\\.2.*null.*" 92 96 93 97 ); -
protocol/src/test/java/geniusweb/protocol/session/shaop/SHAOPStateTest.java
r18 r20 31 31 import geniusweb.protocol.partyconnection.ProtocolToPartyConn; 32 32 import geniusweb.protocol.partyconnection.ProtocolToPartyConnections; 33 import geniusweb.protocol.session.SessionResult; 33 34 import geniusweb.protocol.session.TeamOfPartiesAndProfiles; 34 35 import tudelft.utilities.junit.GeneralTests; … … 314 315 } 315 316 317 @Test 318 public void getResultTest() { 319 320 Map<PartyId, Double> spent = new HashMap<>(); 321 spent.put(party1, 0.1d); 322 SHAOPState state = new SHAOPState(actions, connections4, 323 new ProgressRounds(10, 0, null), settings, null, 0, partynrs, 324 spent); 325 SessionResult res = state.getResult(); 326 327 } 328 316 329 } -
protocol/src/test/java/geniusweb/protocol/tournament/allpermutations/AllPermutationsProtocolTest.java
r10 r20 23 23 import geniusweb.protocol.CurrentNegoState; 24 24 import geniusweb.protocol.NegoState; 25 import geniusweb.protocol.SessionResult;26 25 import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory; 27 26 import geniusweb.protocol.session.SessionProtocol; 27 import geniusweb.protocol.session.SessionResult; 28 28 import geniusweb.protocol.session.SessionSettings; 29 29 import geniusweb.protocol.session.SessionState; … … 46 46 private Bid agreement = mock(Bid.class); 47 47 private final long NOW = 1000; 48 private SessionResult finalstate = mock(SessionResult.class); 48 49 49 50 @Before … … 53 54 when(finalsessionstate.getSettings()).thenReturn(settings); 54 55 when(finalsessionstate.getAgreement()).thenReturn(agreement); 56 when(finalsessionstate.getResult()).thenReturn(finalstate); 57 when(finalstate.getAgreement()).thenReturn(agreement); 55 58 when(state.with(any())).thenReturn(newstate); 56 59 } -
protocol/src/test/java/geniusweb/protocol/tournament/allpermutations/AllPermutationsStateTest.java
r10 r20 13 13 import org.junit.Test; 14 14 15 import geniusweb.protocol. SessionResult;15 import geniusweb.protocol.session.SessionResult; 16 16 import geniusweb.protocol.session.SessionSettings; 17 17 import geniusweb.references.PartyWithProfile;
Note:
See TracChangeset
for help on using the changeset viewer.