@Test public void testReject() { InterledgerRejectPacket reject = packetRejector .reject(LINK_ID, PREPARE_PACKET, InterledgerErrorCode.T02_PEER_BUSY, "the error"); assertThat(reject.getCode()).isEqualTo(InterledgerErrorCode.T02_PEER_BUSY); assertThat(reject.getTriggeredBy().get()).isEqualTo(OPERATOR_ADDRESS); assertThat(reject.getMessage()).isEqualTo("the error"); assertThat(reject.getData().length).isEqualTo(0); }
public InterledgerRejectPacket reject( final LinkId rejectingLinkId, final InterledgerPreparePacket preparePacket, final InterledgerErrorCode errorCode, final String errorMessage ) { Objects.requireNonNull(rejectingLinkId, "rejectingLinkId must not be null"); Objects.requireNonNull(preparePacket, "preparePacket must not be null"); Objects.requireNonNull(errorCode, "errorCode must not be null"); Objects.requireNonNull(errorMessage, "errorMessage must not be null"); final InterledgerRejectPacket rejectPacket = InterledgerRejectPacket.builder() .triggeredBy(operatorAddressSupplier.get()) .code(errorCode) .message(errorMessage) .build(); logger.debug( "Rejecting inside linkId={}: PreparePacket={} RejectPacket={}", rejectingLinkId, preparePacket, rejectPacket ); return rejectPacket; }
PacketRejector { public InterledgerRejectPacket reject( final LinkId rejectingLinkId, final InterledgerPreparePacket preparePacket, final InterledgerErrorCode errorCode, final String errorMessage ) { Objects.requireNonNull(rejectingLinkId, "rejectingLinkId must not be null"); Objects.requireNonNull(preparePacket, "preparePacket must not be null"); Objects.requireNonNull(errorCode, "errorCode must not be null"); Objects.requireNonNull(errorMessage, "errorMessage must not be null"); final InterledgerRejectPacket rejectPacket = InterledgerRejectPacket.builder() .triggeredBy(operatorAddressSupplier.get()) .code(errorCode) .message(errorMessage) .build(); logger.debug( "Rejecting inside linkId={}: PreparePacket={} RejectPacket={}", rejectingLinkId, preparePacket, rejectPacket ); return rejectPacket; } }
PacketRejector { public InterledgerRejectPacket reject( final LinkId rejectingLinkId, final InterledgerPreparePacket preparePacket, final InterledgerErrorCode errorCode, final String errorMessage ) { Objects.requireNonNull(rejectingLinkId, "rejectingLinkId must not be null"); Objects.requireNonNull(preparePacket, "preparePacket must not be null"); Objects.requireNonNull(errorCode, "errorCode must not be null"); Objects.requireNonNull(errorMessage, "errorMessage must not be null"); final InterledgerRejectPacket rejectPacket = InterledgerRejectPacket.builder() .triggeredBy(operatorAddressSupplier.get()) .code(errorCode) .message(errorMessage) .build(); logger.debug( "Rejecting inside linkId={}: PreparePacket={} RejectPacket={}", rejectingLinkId, preparePacket, rejectPacket ); return rejectPacket; } PacketRejector(final Supplier<InterledgerAddress> operatorAddressSupplier); }
PacketRejector { public InterledgerRejectPacket reject( final LinkId rejectingLinkId, final InterledgerPreparePacket preparePacket, final InterledgerErrorCode errorCode, final String errorMessage ) { Objects.requireNonNull(rejectingLinkId, "rejectingLinkId must not be null"); Objects.requireNonNull(preparePacket, "preparePacket must not be null"); Objects.requireNonNull(errorCode, "errorCode must not be null"); Objects.requireNonNull(errorMessage, "errorMessage must not be null"); final InterledgerRejectPacket rejectPacket = InterledgerRejectPacket.builder() .triggeredBy(operatorAddressSupplier.get()) .code(errorCode) .message(errorMessage) .build(); logger.debug( "Rejecting inside linkId={}: PreparePacket={} RejectPacket={}", rejectingLinkId, preparePacket, rejectPacket ); return rejectPacket; } PacketRejector(final Supplier<InterledgerAddress> operatorAddressSupplier); InterledgerRejectPacket reject(
      final LinkId rejectingLinkId, final InterledgerPreparePacket preparePacket,
      final InterledgerErrorCode errorCode, final String errorMessage
  ); }
PacketRejector { public InterledgerRejectPacket reject( final LinkId rejectingLinkId, final InterledgerPreparePacket preparePacket, final InterledgerErrorCode errorCode, final String errorMessage ) { Objects.requireNonNull(rejectingLinkId, "rejectingLinkId must not be null"); Objects.requireNonNull(preparePacket, "preparePacket must not be null"); Objects.requireNonNull(errorCode, "errorCode must not be null"); Objects.requireNonNull(errorMessage, "errorMessage must not be null"); final InterledgerRejectPacket rejectPacket = InterledgerRejectPacket.builder() .triggeredBy(operatorAddressSupplier.get()) .code(errorCode) .message(errorMessage) .build(); logger.debug( "Rejecting inside linkId={}: PreparePacket={} RejectPacket={}", rejectingLinkId, preparePacket, rejectPacket ); return rejectPacket; } PacketRejector(final Supplier<InterledgerAddress> operatorAddressSupplier); InterledgerRejectPacket reject(
      final LinkId rejectingLinkId, final InterledgerPreparePacket preparePacket,
      final InterledgerErrorCode errorCode, final String errorMessage
  );  }