- 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/SAOPTest.java
r9 r10 20 20 import java.util.List; 21 21 import java.util.Map; 22 import java.util.stream.Collectors; 22 23 23 24 import org.junit.Test; … … 39 40 import geniusweb.progress.Progress; 40 41 import geniusweb.protocol.ProtocolException; 41 import geniusweb.protocol.partyconnection.ProtocolToPartyConnections;42 42 import geniusweb.protocol.partyconnection.ProtocolToPartyConn; 43 43 import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory; 44 import geniusweb.protocol.partyconnection.ProtocolToPartyConnections; 45 import geniusweb.protocol.session.TeamOfPartiesAndProfiles; 44 46 import geniusweb.references.Parameters; 45 47 import geniusweb.references.PartyRef; … … 73 75 private final PartyRef party2ref = mock(PartyRef.class); 74 76 private final SAOPSettings settings = mock(SAOPSettings.class); 75 private final PartyWithProfile party1 = mock(PartyWithProfile.class);76 private final PartyWithProfile party2 = mock(PartyWithProfile.class);77 private final SaopPartyWithProfile team1 = mock(SaopPartyWithProfile.class); 78 private final SaopPartyWithProfile team2 = mock(SaopPartyWithProfile.class); 77 79 private SAOP saop; 78 80 private ProtocolToPartyConnFactory factory; … … 80 82 private ProtocolToPartyConn conn1 = mock(ProtocolToPartyConn.class), 81 83 conn2 = mock(ProtocolToPartyConn.class); 82 private Map<PartyId, PartyWithProfile> partyprofiles;84 private Map<PartyId, SaopPartyWithProfile> partyprofiles; 83 85 private Progress progress = mock(Progress.class); 84 86 private ProfileRef profile1; … … 101 103 throws URISyntaxException, IOException, NoResourcesNowException { 102 104 SAOP = new ProtocolRef("SAOP"); 103 when(party1.getParty()).thenReturn(partywithparam1); 104 when(party2.getParty()).thenReturn(partywithparam2); 105 when(team1.getParty()).thenReturn(partywithparam1); 106 when(team2.getParty()).thenReturn(partywithparam2); 107 when(team1.getAllParties()).thenReturn(Arrays.asList(team1)); 108 when(team2.getAllParties()).thenReturn(Arrays.asList(team2)); 105 109 106 110 partyprofiles = new HashMap<>(); 107 partyprofiles.put(PARTY1ID, party1);108 partyprofiles.put(PARTY2ID, party2);111 partyprofiles.put(PARTY1ID, team1); 112 partyprofiles.put(PARTY2ID, team2); 109 113 110 114 when(deadlinetime.getDuration()).thenReturn(1000l); 111 115 112 List<PartyWithProfile> participants = new ArrayList<>(); 113 participants.add(party1); 114 participants.add(party2); 115 when(settings.getParticipants()).thenReturn(participants); 116 List<TeamOfPartiesAndProfiles> teams = new ArrayList<>(); 117 teams.add(team1); 118 teams.add(team2); 119 when(settings.getTeams()).thenReturn(teams); 120 when(settings.getAllParties()).thenReturn(Arrays.asList(team1, team2)); 116 121 when(settings.getDeadline()).thenReturn(deadlinetime); 117 122 … … 126 131 127 132 profile1 = mock(ProfileRef.class); 128 when( party1.getProfile()).thenReturn(profile1);133 when(team1.getProfile()).thenReturn(profile1); 129 134 profile2 = mock(ProfileRef.class); 130 when( party2.getProfile()).thenReturn(profile2);135 when(team2.getProfile()).thenReturn(profile2); 131 136 132 137 mockState(connectedstate, "connected state"); … … 157 162 when(state.getSettings()).thenReturn(settings); 158 163 when(state.getConnections()).thenReturn(connectionswithparties); 159 when(state.getPartyProfiles()).thenReturn(partyprofiles); 164 when(state.getPartyProfiles()) 165 .thenReturn(partyprofiles.entrySet().stream().collect( 166 Collectors.toMap(e -> e.getKey(), e -> e.getValue()))); 160 167 when(state.getProgress()).thenReturn(progress); 161 168 when(state.with(any(ProtocolToPartyConn.class),
Note:
See TracChangeset
for help on using the changeset viewer.