use of io.spine.server.stand.Given.StandTestProjection in project core-java by SpineEventEngine.
the class StandShould method toProjectionCollection.
private static ImmutableCollection<Given.StandTestProjection> toProjectionCollection(Collection<ProjectId> values) {
final Collection<Given.StandTestProjection> transformed = Collections2.transform(values, new Function<ProjectId, Given.StandTestProjection>() {
@Override
public StandTestProjection apply(@Nullable ProjectId input) {
checkNotNull(input);
return new StandTestProjection(input);
}
});
final ImmutableList<Given.StandTestProjection> result = ImmutableList.copyOf(transformed);
return result;
}
use of io.spine.server.stand.Given.StandTestProjection in project core-java by SpineEventEngine.
the class StandShould method setupExpectedFindAllBehaviour.
@SuppressWarnings("ConstantConditions")
private static void setupExpectedFindAllBehaviour(Map<ProjectId, Project> sampleProjects, StandTestProjectionRepository projectionRepository) {
final Set<ProjectId> projectIds = sampleProjects.keySet();
final ImmutableCollection<Given.StandTestProjection> allResults = toProjectionCollection(projectIds);
for (ProjectId projectId : projectIds) {
when(projectionRepository.find(eq(projectId))).thenReturn(Optional.of(new StandTestProjection(projectId)));
}
final Iterable<ProjectId> matchingIds = argThat(projectionIdsIterableMatcher(projectIds));
when(projectionRepository.loadAll(matchingIds, any(FieldMask.class))).thenReturn(allResults);
when(projectionRepository.loadAll()).thenReturn(allResults);
final EntityFilters matchingFilter = argThat(entityFilterMatcher(projectIds));
when(projectionRepository.find(matchingFilter, any(FieldMask.class))).thenReturn(allResults);
}
Aggregations