### Question:
PartyService { public DisbandResult disband(String playerName) { Set<String> members = getInvitedMembers(playerName); DisbandResult result = partyRepository.disband(playerName); if (result.success()) { playerMessaging.distribute( members, PartyDisband::new); } return result; }  CreateResult create(String playerName); Set<String> getInvitedMembers(String playerName); RemoveResult remove(String applicant, String playerName); AcceptResult accept(String owner, String player); DisbandResult disband(String playerName); InviteResult invite(String owner, String player); boolean partyChat(String member, String text); static final int EXPIRATION_TIME; }### Answer:
@Test public void disband() { PartyRepository repository = mock(PartyRepository.class); PreferencesRepository preferencesRepository = mock(PreferencesRepository.class); PlayerMessaging playerMessaging = mock(PlayerMessaging.class); PartyService partyService = new PartyService( repository, preferencesRepository, playerMessaging ); when(repository.getPartyMembers(eq("owner"))).thenReturn( new HashSet<>(Arrays.asList("a", "b", "c", "owner")) ); when(repository.disband(any())).thenReturn(new DisbandResult(true, new HashSet<>( Arrays.asList("a", "b", "c") ))); assertEquals(true, partyService.disband("owner").success()); verify(playerMessaging).distribute(eq(new HashSet<>(Arrays.asList("a", "b", "c"))), any()); }