Search in sources :

Example 1 with StandTestProjection

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;
}
Also used : StandTestProjection(io.spine.server.stand.Given.StandTestProjection) ProjectId(io.spine.test.projection.ProjectId)

Example 2 with StandTestProjection

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);
}
Also used : StandTestProjection(io.spine.server.stand.Given.StandTestProjection) EntityFilters(io.spine.client.EntityFilters) ProjectId(io.spine.test.projection.ProjectId) FieldMask(com.google.protobuf.FieldMask)

Aggregations

StandTestProjection (io.spine.server.stand.Given.StandTestProjection)2 ProjectId (io.spine.test.projection.ProjectId)2 FieldMask (com.google.protobuf.FieldMask)1 EntityFilters (io.spine.client.EntityFilters)1