Checkpoint: Added ExchangeServiceTest
Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
@ -1,7 +1,10 @@
|
||||
package com.plannaplan.services;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.plannaplan.entities.Assignment;
|
||||
import com.plannaplan.entities.Exchange;
|
||||
@ -62,9 +65,14 @@ public class ExchangeService {
|
||||
|
||||
}
|
||||
|
||||
// public void getMatches(){
|
||||
// final List<MatchData> matches = this.repo.getMatches().stream().map(m -> {
|
||||
// return (MatchData) m;
|
||||
// });
|
||||
// }
|
||||
public Set<MatchData> getMatches(){
|
||||
final List<MatchData> matches = this.repo.getMatches().stream().map(m -> {
|
||||
final Exchange exchangeOne = (Exchange) m[0];
|
||||
final Exchange exchangeTwo = (Exchange) m[1];
|
||||
return new MatchData(exchangeOne.getOwnedAssignment(), exchangeTwo.getOwnedAssignment());
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
final Set<MatchData> filterMatches = new HashSet<>(matches);
|
||||
return filterMatches;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user