### Question:
LimitedTransactionsMessages { public static LimitedTransactionsMessages createLimited( final Iterable<Transaction> transactions) { final Set<Transaction> includedTransactions = new HashSet<>(); final BytesValueRLPOutput message = new BytesValueRLPOutput(); int messageSize = 0; message.startList(); for (final Transaction transaction : transactions) { final BytesValueRLPOutput encodedTransaction = new BytesValueRLPOutput(); transaction.writeTo(encodedTransaction); Bytes encodedBytes = encodedTransaction.encoded(); if (encodedBytes.size() > LIMIT && (messageSize != 0)) { break; } message.writeRLPUnsafe(encodedBytes); includedTransactions.add(transaction); messageSize += encodedBytes.size(); if (messageSize > LIMIT) { break; } } message.endList(); return new LimitedTransactionsMessages( new TransactionsMessage(message.encoded()), includedTransactions); } LimitedTransactionsMessages(
      final TransactionsMessage transactionsMessage, final Set<Transaction> includedTransactions); static LimitedTransactionsMessages createLimited(
      final Iterable<Transaction> transactions); final TransactionsMessage getTransactionsMessage(); final Set<Transaction> getIncludedTransactions();  }### Answer:
@Test public void createLimited() { final Set<Transaction> txs = generator.transactions(6000); final LimitedTransactionsMessages firstMessage = LimitedTransactionsMessages.createLimited(txs); assertThat(firstMessage.getIncludedTransactions().size()).isBetween(4990, 5250); txs.removeAll(firstMessage.getIncludedTransactions()); assertThat(txs.size()).isBetween(700, 800); final LimitedTransactionsMessages secondMessage = LimitedTransactionsMessages.createLimited(txs); assertThat(secondMessage.getIncludedTransactions().size()).isBetween(700, 800); txs.removeAll(secondMessage.getIncludedTransactions()); assertThat(txs.size()).isEqualTo(0); assertThat( firstMessage.getTransactionsMessage().getSize() + secondMessage.getTransactionsMessage().getSize()) .isLessThan(2 * LimitedTransactionsMessages.LIMIT); }