### Question:
FeedCachePartition { public void addAll(List<RecordHeader> recordHeaderList) { synchronized (this) { if (refCount > 0) { FeedCacheBlock block = null; for (RecordHeader recordHeader : recordHeaderList) { while (block == null || !block.add(recordHeader.transactionId, recordHeader.reqId, recordHeader.header)) { FeedCacheBlockKey key = FeedCacheBlockKey.get(partitionId, recordHeader.transactionId); block = localPool.get(key); if (block == null) { block = checkOut(key); if (block == null) { return; } } } } } } } FeedCachePartition(int partitionId, FeedCache feedCache); void open(); void close(); void clear(); void setMaxNumBlocks(int numBlocks); int getMaxNumBlocks(); void add(long transactionId, ReqId reqId, int header); void addAll(List<RecordHeader> recordHeaderList); FeedData get(long transactionId);  }### Answer:
@Test public void testAddAll() { List<RecordHeader> recordHeaderList = new ArrayList<>(); for (long txnId = 0; txnId < NUM_BLOCKS * FeedCacheBlock.NUM_TRANSACTIONS; txnId++) { recordHeaderList.add(new RecordHeader(txnId, generateReqId(txnId), generateHeader(txnId))); } partition.addAll(recordHeaderList); for (RecordHeader recordHeader : recordHeaderList) { FeedData data = partition.get(recordHeader.transactionId); assertNotNull("txnId=" + recordHeader.transactionId, data); assertEquals(recordHeader.transactionId, data.transactionId); assertEquals(generateReqId(recordHeader.transactionId), data.reqId); assertEquals(generateHeader(recordHeader.transactionId), data.header); } assertNull(partition.get(NUM_BLOCKS * FeedCacheBlock.NUM_TRANSACTIONS)); partition.clear(); recordHeaderList.clear(); for (long i = 0; i < NUM_BLOCKS * FeedCacheBlock.NUM_TRANSACTIONS; i++) { long txnId = NUM_BLOCKS * FeedCacheBlock.NUM_TRANSACTIONS + i; recordHeaderList.add(new RecordHeader(txnId, generateReqId(txnId), generateHeader(txnId))); } Collections.shuffle(recordHeaderList); partition.addAll(recordHeaderList); for (RecordHeader recordHeader : recordHeaderList) { FeedData data = partition.get(recordHeader.transactionId); assertNotNull("txnId=" + recordHeader.transactionId, data); assertEquals(recordHeader.transactionId, data.transactionId); assertEquals(generateReqId(recordHeader.transactionId), data.reqId); assertEquals(generateHeader(recordHeader.transactionId), data.header); } assertNull(partition.get(0)); }