@Test public void shouldSuccessfullyCreateMessageBlockInstance() { final IEXMessageHeaderDataBuilder messageHeaderBuilder = IEXMessageHeaderDataBuilder.messageHeader() .withMessageCount((short) 2); final IEXTradeMessageDataBuilder tradeMessageBuilder = IEXTradeMessageDataBuilder.tradeMessage(); final IEXQuoteUpdateMessageDataBuilder quoteUpdateMessageBuilder = IEXQuoteUpdateMessageDataBuilder.quoteMessage(); final byte[] bytes = prepareMessages(messageHeaderBuilder, tradeMessageBuilder, quoteUpdateMessageBuilder); final IEXSegment segment = IEXTOPSMessageBlock.createIEXSegment(bytes); assertThat(segment.getMessages()).hasSize(2); assertThat(segment.getMessageHeader()).isEqualTo(messageHeaderBuilder.build()); assertThat(segment.getMessages().get(0)).isEqualTo(tradeMessageBuilder.build()); assertThat(segment.getMessages().get(1)).isEqualTo(quoteUpdateMessageBuilder.build()); }
public static IEXSegment createIEXSegment(final byte[] packet) { final List<IEXMessage> iexMessages = new ArrayList<>(); int offset = 40; final IEXMessageHeader iexMessageHeader = IEXMessageHeader.createIEXMessageHeader(Arrays.copyOfRange(packet, 0, offset)); for (int i = 0; i < iexMessageHeader.getMessageCount(); i++) { short length = IEXByteConverter.convertBytesToShort(Arrays.copyOfRange(packet, offset, offset = offset + 2)); iexMessages.add(resolveMessage(Arrays.copyOfRange(packet, offset, offset = offset + length))); } return new IEXTOPSMessageBlock(iexMessageHeader, iexMessages); }
IEXTOPSMessageBlock extends IEXSegment { public static IEXSegment createIEXSegment(final byte[] packet) { final List<IEXMessage> iexMessages = new ArrayList<>(); int offset = 40; final IEXMessageHeader iexMessageHeader = IEXMessageHeader.createIEXMessageHeader(Arrays.copyOfRange(packet, 0, offset)); for (int i = 0; i < iexMessageHeader.getMessageCount(); i++) { short length = IEXByteConverter.convertBytesToShort(Arrays.copyOfRange(packet, offset, offset = offset + 2)); iexMessages.add(resolveMessage(Arrays.copyOfRange(packet, offset, offset = offset + length))); } return new IEXTOPSMessageBlock(iexMessageHeader, iexMessages); } }
IEXTOPSMessageBlock extends IEXSegment { public static IEXSegment createIEXSegment(final byte[] packet) { final List<IEXMessage> iexMessages = new ArrayList<>(); int offset = 40; final IEXMessageHeader iexMessageHeader = IEXMessageHeader.createIEXMessageHeader(Arrays.copyOfRange(packet, 0, offset)); for (int i = 0; i < iexMessageHeader.getMessageCount(); i++) { short length = IEXByteConverter.convertBytesToShort(Arrays.copyOfRange(packet, offset, offset = offset + 2)); iexMessages.add(resolveMessage(Arrays.copyOfRange(packet, offset, offset = offset + length))); } return new IEXTOPSMessageBlock(iexMessageHeader, iexMessages); } private  IEXTOPSMessageBlock(final IEXMessageHeader messageHeader, final List<IEXMessage> messages); }
IEXTOPSMessageBlock extends IEXSegment { public static IEXSegment createIEXSegment(final byte[] packet) { final List<IEXMessage> iexMessages = new ArrayList<>(); int offset = 40; final IEXMessageHeader iexMessageHeader = IEXMessageHeader.createIEXMessageHeader(Arrays.copyOfRange(packet, 0, offset)); for (int i = 0; i < iexMessageHeader.getMessageCount(); i++) { short length = IEXByteConverter.convertBytesToShort(Arrays.copyOfRange(packet, offset, offset = offset + 2)); iexMessages.add(resolveMessage(Arrays.copyOfRange(packet, offset, offset = offset + length))); } return new IEXTOPSMessageBlock(iexMessageHeader, iexMessages); } private  IEXTOPSMessageBlock(final IEXMessageHeader messageHeader, final List<IEXMessage> messages); static IEXSegment createIEXSegment(final byte[] packet); }
IEXTOPSMessageBlock extends IEXSegment { public static IEXSegment createIEXSegment(final byte[] packet) { final List<IEXMessage> iexMessages = new ArrayList<>(); int offset = 40; final IEXMessageHeader iexMessageHeader = IEXMessageHeader.createIEXMessageHeader(Arrays.copyOfRange(packet, 0, offset)); for (int i = 0; i < iexMessageHeader.getMessageCount(); i++) { short length = IEXByteConverter.convertBytesToShort(Arrays.copyOfRange(packet, offset, offset = offset + 2)); iexMessages.add(resolveMessage(Arrays.copyOfRange(packet, offset, offset = offset + length))); } return new IEXTOPSMessageBlock(iexMessageHeader, iexMessages); } private  IEXTOPSMessageBlock(final IEXMessageHeader messageHeader, final List<IEXMessage> messages); static IEXSegment createIEXSegment(final byte[] packet);  }