### Question:
ExcludedTransactionDbIdExtractor { public ExcludeInfo getExcludeInfo(int startHeight, int finishHeight) { log.debug("get Info: start={}, finish={}", startHeight, finishHeight); if (startHeight >= finishHeight) { throw new IllegalArgumentException("startHeight should be less than finish height but got start=" + startHeight + " and finish" + finishHeight); } List<TransactionDbInfo> activePhasedTransactions = phasingPollService.getActivePhasedTransactionDbInfoAtHeight(finishHeight); log.trace("get activePhasedTransactions: {}", activePhasedTransactions); List<TransactionDbInfo> transactionsBeforeHeight = blockchain.getTransactionsBeforeHeight(startHeight); log.trace("get transactionsBeforeHeight: {}", transactionsBeforeHeight); List<TransactionDbInfo> deleteNotExportNotCopy = transactionsBeforeHeight.stream().filter(tdi -> !activePhasedTransactions.contains(tdi)).collect(Collectors.toList()); log.trace("get deleteNotExportNotCopy: {}", deleteNotExportNotCopy); List<TransactionDbInfo> notDeleteExportNotCopy = transactionsBeforeHeight.stream().filter(activePhasedTransactions::contains).collect(Collectors.toList()); log.trace("get notDeleteExportNotCopy: {}", notDeleteExportNotCopy); List<TransactionDbInfo> notDeleteExportCopy = activePhasedTransactions.stream().filter(e -> !notDeleteExportNotCopy.contains(e)).collect(Collectors.toList()); log.trace("get notDeleteExportCopy: {}", notDeleteExportCopy); return new ExcludeInfo(deleteNotExportNotCopy, notDeleteExportNotCopy, notDeleteExportCopy); } @Inject  ExcludedTransactionDbIdExtractor(PhasingPollService phasingPollService, Blockchain blockchain); ExcludeInfo getExcludeInfo(int startHeight, int finishHeight);  }### Answer:
@Test void testGetExcludeInfo() { doReturn(List.of(new TransactionDbInfo(1, 2), new TransactionDbInfo(2, 3), new TransactionDbInfo(5, 10))).when(blockchain).getTransactionsBeforeHeight(100); doReturn(List.of(new TransactionDbInfo(2, 3), new TransactionDbInfo(3, 4))).when(phasingPollService).getActivePhasedTransactionDbInfoAtHeight(120); ExcludeInfo excludeInfo = extractor.getExcludeInfo(100, 120); assertEquals(Set.of(3L, 2L), excludeInfo.getExportDbIds()); assertEquals(Set.of(1L, 2L, 5L), excludeInfo.getNotCopyDbIds()); assertEquals(Set.of(2L, 3L), excludeInfo.getNotDeleteDbIds()); verify(blockchain, only()).getTransactionsBeforeHeight(100); verify(phasingPollService, only()).getActivePhasedTransactionDbInfoAtHeight(120); }
@Test void testGetExcludeInfoWhenStartHeightEqualToFinishHeight() { assertThrows(IllegalArgumentException.class, () -> extractor.getExcludeInfo(100, 100)); }