sijie commented on a change in pull request #1042: ISSUE #1041: Adding new
testcases
URL: https://github.com/apache/bookkeeper/pull/1042#discussion_r163146124
##########
File path:
bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookieWriteLedgerTest.java
##########
@@ -801,6 +959,24 @@ private void readEntries(LedgerHandle lh, List<byte[]>
entries) throws Interrupt
}
}
+ private void readEntriesAndValidateDataArray(LedgerHandle lh, List<byte[]>
entries)
+ throws InterruptedException, BKException {
+ ls = lh.readEntries(0, entries.size() - 1);
+ int index = 0;
+ while (ls.hasMoreElements()) {
+ byte[] originalData = entries.get(index++);
+ byte[] receivedData = ls.nextElement().getEntry();
+ LOG.debug("Length of originalData: " + originalData.length);
+ LOG.debug("Length of receivedData: " + receivedData.length);
+ assertTrue(
+ String.format("LedgerID: %d EntryID: %d
OriginalDataLength: %d ReceivedDataLength: %d", lh.getId(),
+ (index - 1), originalData.length,
receivedData.length),
+ originalData.length == receivedData.length);
+ assertTrue(String.format("Checking LedgerID: %d EntryID: %d for
equality", lh.getId(), (index - 1)),
Review comment:
user assertArrayEquals. it is better than `assertTrue`, because it would
show the diff when the arrays don't equal.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services