test_class.declarator: listener
test_class.modifier: private
test_class.original_string: private MemoizingListener listener;
test_class.type: MemoizingListener
test_class.var_name: listener
test_class.declarator: publisher
test_class.modifier: private
test_class.original_string: private AckRejectionPublisher publisher;
test_class.type: AckRejectionPublisher
test_class.var_name: publisher
test_class.file: server/src/test/java/io/spine/server/commandbus/AckRejectionPublisherTest.java
test_class.identifier: AckRejectionPublisherTest
test_case.body: @Test
      @DisplayName("publish the passed rejection to event bus")
      void publishRejection() {
          TestActorRequestFactory requestFactory =
                  new TestActorRequestFactory(AckRejectionPublisherTest.class);
          Command command = requestFactory.generateCommand();
          CommandEnvelope origin = CommandEnvelope.of(command);
  
          CmdBusEntryDenied throwableMessage = CmdBusEntryDenied
                  .newBuilder()
                  .setId(CmdBusCaffetteriaId.generate())
                  .setVisitorCount(15)
                  .setReason("Test command bus rejection.")
                  .build();
          RejectionEnvelope rejection = RejectionEnvelope.from(origin, throwableMessage);
          Ack ack = Acks.reject(CommandId.generate(), rejection);
          publisher.onNext(ack);
          assertThat(listener.lastReceived).isNotNull();
          assertThat(listener.lastReceived.message()).isEqualTo(throwableMessage.messageThrown());
      }
test_case.class_method_signature: AckRejectionPublisherTest.publishRejection()
test_case.full_signature: @Test @DisplayName("publish the passed rejection to event bus") void publishRejection()
test_case.identifier: publishRejection
test_case.invocations: generateCommand of build setReason setVisitorCount setId newBuilder generate from reject generate onNext isNotNull assertThat isEqualTo assertThat message messageThrown
test_case.modifiers: @Test @DisplayName("publish the passed rejection to event bus")
test_case.parameters: ()
test_case.return: void
test_case.signature: void publishRejection()
focal_class.declarator: eventBus
focal_class.modifier: private final
focal_class.original_string: private final EventBus eventBus;
focal_class.type: EventBus
focal_class.var_name: eventBus
focal_class.file: server/src/main/java/io/spine/server/commandbus/AckRejectionPublisher.java
focal_class.identifier: AckRejectionPublisher
focal_class.interfaces: implements StreamObserver<Ack>
focal_class.class_method_signature: AckRejectionPublisher.AckRejectionPublisher(EventBus eventBus)
focal_class.full_signature:   AckRejectionPublisher(EventBus eventBus)
focal_class.identifier: AckRejectionPublisher
focal_class.parameters: (EventBus eventBus)
focal_class.signature:  AckRejectionPublisher(EventBus eventBus)
focal_class.class_method_signature: AckRejectionPublisher.onNext(Ack value)
focal_class.full_signature: @Override public void onNext(Ack value)
focal_class.identifier: onNext
focal_class.modifiers: @Override public
focal_class.parameters: (Ack value)
focal_class.return: void
focal_class.signature: void onNext(Ack value)
focal_class.class_method_signature: AckRejectionPublisher.onError(Throwable t)
focal_class.full_signature: @Override public void onError(Throwable t)
focal_class.identifier: onError
focal_class.modifiers: @Override public
focal_class.parameters: (Throwable t)
focal_class.return: void
focal_class.signature: void onError(Throwable t)
focal_class.class_method_signature: AckRejectionPublisher.onCompleted()
focal_class.full_signature: @Override public void onCompleted()
focal_class.identifier: onCompleted
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void onCompleted()
focal_method.body: @Override
      public void onNext(Ack value) {
          checkNotNull(value);
          Status status = value.getStatus();
          if (status.getStatusCase() == REJECTION) {
              eventBus.post(status.getRejection());
          }
      }
focal_method.class_method_signature: AckRejectionPublisher.onNext(Ack value)
focal_method.full_signature: @Override public void onNext(Ack value)
focal_method.identifier: onNext
focal_method.invocations: checkNotNull getStatus getStatusCase post getRejection
focal_method.modifiers: @Override public
focal_method.parameters: (Ack value)
focal_method.return: void
focal_method.signature: void onNext(Ack value)