@Test(expected = NullPointerException.class) public void nullErrorCode() { try { packetRejector.reject(LINK_ID, PREPARE_PACKET, null, ""); fail(); } catch (NullPointerException e) { assertThat(e.getMessage()).isEqualTo("errorCode must not be null"); throw e; } }
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
  );  }