0

How to write a test case using Mockito that doesn't fail when the processOrderResponse(bytesMessage, rawTextMessage) (it is a private method of that class) is called?

I want to mock a test case where it returns the response header, but it stops at the processOrderResponse(bytesMessage, rawTextMessage) method and does not return the response header.

public OrderResponseHeader processOrderResponse(BytesMessage bytesMessage) throws JMSException, UnsupportedEncodingException {
    String rawTextMessage = serviceHelper.getIbmMessage(bytesMessage);
    log.info("Message : {} is received from IDS to send Order Response",
            rawTextMessage.length() > 20 ? MessageFormat.format("{0}...", rawTextMessage.substring(20)) : rawTextMessage);
    OrderResponseHeader responseHeader = processOrderResponse(bytesMessage, rawTextMessage);
    log.info("OrderResponseHeader : {} is saved in Database Successfully with status : {}", responseHeader.getOrderResponseHeaderId(),
            responseHeader.getOrderInfo().getStatus().getStatus());
    return responseHeader;
}
Mark Rotteveel
  • 90,369
  • 161
  • 124
  • 175
tv2k18
  • 19
  • 3

0 Answers0