Search in sources :

Example 1 with PrjProjectArchived

use of io.spine.test.projection.event.PrjProjectArchived in project core-java by SpineEventEngine.

the class ProjectionRepositoryShould method dispatch_event_to_archived_projection.

@Test
public void dispatch_event_to_archived_projection() {
    final PrjProjectArchived projectArchived = GivenEventMessage.projectArchived();
    checkDispatchesEvent(projectArchived);
    final ProjectId projectId = projectArchived.getProjectId();
    TestProjection projection = repository().findOrCreate(projectId);
    assertTrue(projection.isArchived());
    // Dispatch an event to the archived projection.
    checkDispatchesEvent(GivenEventMessage.taskAdded());
    projection = repository().findOrCreate(projectId);
    final List<Task> addedTasks = projection.getState().getTaskList();
    assertFalse(addedTasks.isEmpty());
    // Check that the projection was not re-created before dispatching.
    assertTrue(projection.isArchived());
}
Also used : Task(io.spine.test.projection.Task) PrjProjectArchived(io.spine.test.projection.event.PrjProjectArchived) ProjectId(io.spine.test.projection.ProjectId) TestProjection(io.spine.server.projection.given.ProjectionRepositoryTestEnv.TestProjection) Test(org.junit.Test)

Aggregations

TestProjection (io.spine.server.projection.given.ProjectionRepositoryTestEnv.TestProjection)1 ProjectId (io.spine.test.projection.ProjectId)1 Task (io.spine.test.projection.Task)1 PrjProjectArchived (io.spine.test.projection.event.PrjProjectArchived)1 Test (org.junit.Test)1