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/SAOPTest.java

    r9 r10  
    2020import java.util.List;
    2121import java.util.Map;
     22import java.util.stream.Collectors;
    2223
    2324import org.junit.Test;
     
    3940import geniusweb.progress.Progress;
    4041import geniusweb.protocol.ProtocolException;
    41 import geniusweb.protocol.partyconnection.ProtocolToPartyConnections;
    4242import geniusweb.protocol.partyconnection.ProtocolToPartyConn;
    4343import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory;
     44import geniusweb.protocol.partyconnection.ProtocolToPartyConnections;
     45import geniusweb.protocol.session.TeamOfPartiesAndProfiles;
    4446import geniusweb.references.Parameters;
    4547import geniusweb.references.PartyRef;
     
    7375        private final PartyRef party2ref = mock(PartyRef.class);
    7476        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);
    7779        private SAOP saop;
    7880        private ProtocolToPartyConnFactory factory;
     
    8082        private ProtocolToPartyConn conn1 = mock(ProtocolToPartyConn.class),
    8183                        conn2 = mock(ProtocolToPartyConn.class);
    82         private Map<PartyId, PartyWithProfile> partyprofiles;
     84        private Map<PartyId, SaopPartyWithProfile> partyprofiles;
    8385        private Progress progress = mock(Progress.class);
    8486        private ProfileRef profile1;
     
    101103                        throws URISyntaxException, IOException, NoResourcesNowException {
    102104                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));
    105109
    106110                partyprofiles = new HashMap<>();
    107                 partyprofiles.put(PARTY1ID, party1);
    108                 partyprofiles.put(PARTY2ID, party2);
     111                partyprofiles.put(PARTY1ID, team1);
     112                partyprofiles.put(PARTY2ID, team2);
    109113
    110114                when(deadlinetime.getDuration()).thenReturn(1000l);
    111115
    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));
    116121                when(settings.getDeadline()).thenReturn(deadlinetime);
    117122
     
    126131
    127132                profile1 = mock(ProfileRef.class);
    128                 when(party1.getProfile()).thenReturn(profile1);
     133                when(team1.getProfile()).thenReturn(profile1);
    129134                profile2 = mock(ProfileRef.class);
    130                 when(party2.getProfile()).thenReturn(profile2);
     135                when(team2.getProfile()).thenReturn(profile2);
    131136
    132137                mockState(connectedstate, "connected state");
     
    157162                when(state.getSettings()).thenReturn(settings);
    158163                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())));
    160167                when(state.getProgress()).thenReturn(progress);
    161168                when(state.with(any(ProtocolToPartyConn.class),
Note: See TracChangeset for help on using the changeset viewer.