Search in sources :

Example 1 with MultipleRejectionSubscriber

use of io.spine.server.rejection.given.MultipleRejectionSubscriber in project core-java by SpineEventEngine.

the class RejectionBusShould method call_subscriber_by_rejection_and_command_message_when_rejection_posted.

@Test
public void call_subscriber_by_rejection_and_command_message_when_rejection_posted() {
    final MultipleRejectionSubscriber subscriber = new MultipleRejectionSubscriber();
    rejectionBus.register(subscriber);
    final Class<RjStartProject> commandMessageCls = RjStartProject.class;
    final Rejection rejection = cannotModifyDeletedEntity(commandMessageCls);
    rejectionBus.post(rejection);
    assertEquals(1, subscriber.numberOfSubscriberCalls());
    assertEquals(commandMessageCls, subscriber.commandMessageClass());
}
Also used : Given.missingOwnerRejection(io.spine.server.rejection.given.Given.missingOwnerRejection) Rejection(io.spine.core.Rejection) Given.invalidProjectNameRejection(io.spine.server.rejection.given.Given.invalidProjectNameRejection) MultipleRejectionSubscriber(io.spine.server.rejection.given.MultipleRejectionSubscriber) RjStartProject(io.spine.test.rejection.command.RjStartProject) Test(org.junit.Test)

Example 2 with MultipleRejectionSubscriber

use of io.spine.server.rejection.given.MultipleRejectionSubscriber in project core-java by SpineEventEngine.

the class RejectionBusShould method call_subscriber_by_rejection_message_only.

@Test
public void call_subscriber_by_rejection_message_only() {
    final MultipleRejectionSubscriber subscriber = new MultipleRejectionSubscriber();
    rejectionBus.register(subscriber);
    final Rejection rejection = cannotModifyDeletedEntity(StringValue.class);
    rejectionBus.post(rejection);
    assertEquals(1, subscriber.numberOfSubscriberCalls());
    assertNull(subscriber.commandMessageClass());
}
Also used : Given.missingOwnerRejection(io.spine.server.rejection.given.Given.missingOwnerRejection) Rejection(io.spine.core.Rejection) Given.invalidProjectNameRejection(io.spine.server.rejection.given.Given.invalidProjectNameRejection) MultipleRejectionSubscriber(io.spine.server.rejection.given.MultipleRejectionSubscriber) Test(org.junit.Test)

Aggregations

Rejection (io.spine.core.Rejection)2 Given.invalidProjectNameRejection (io.spine.server.rejection.given.Given.invalidProjectNameRejection)2 Given.missingOwnerRejection (io.spine.server.rejection.given.Given.missingOwnerRejection)2 MultipleRejectionSubscriber (io.spine.server.rejection.given.MultipleRejectionSubscriber)2 Test (org.junit.Test)2 RjStartProject (io.spine.test.rejection.command.RjStartProject)1