### Question:
FilterQuery { public static boolean matchFilter(ContractTrigger trigger) { long blockNumber = trigger.getBlockNumber(); FilterQuery filterQuery = EventPluginLoader.getInstance().getFilterQuery(); if (Objects.isNull(filterQuery)) { return true; } long fromBlockNumber = filterQuery.getFromBlock(); long toBlockNumber = filterQuery.getToBlock(); boolean matched = false; if (fromBlockNumber == FilterQuery.LATEST_BLOCK_NUM || toBlockNumber == FilterQuery.EARLIEST_BLOCK_NUM) { logger.error("invalid filter: fromBlockNumber: {}, toBlockNumber: {}", fromBlockNumber, toBlockNumber); return false; } if (toBlockNumber == FilterQuery.LATEST_BLOCK_NUM) { if (fromBlockNumber == FilterQuery.EARLIEST_BLOCK_NUM) { matched = true; } else { if (blockNumber >= fromBlockNumber) { matched = true; } } } else { if (fromBlockNumber == FilterQuery.EARLIEST_BLOCK_NUM) { if (blockNumber <= toBlockNumber) { matched = true; } } else { if (blockNumber >= fromBlockNumber && blockNumber <= toBlockNumber) { matched = true; } } } if (!matched) { return false; } return filterContractAddress(trigger, filterQuery.getContractAddressList()) && filterContractTopicList(trigger, filterQuery.getContractTopicList()); }  static long parseFromBlockNumber(String blockNum); static long parseToBlockNumber(String blockNum); static boolean matchFilter(ContractTrigger trigger); @Override String toString(); static final int EARLIEST_BLOCK_NUM; static final int LATEST_BLOCK_NUM; static final String EARLIEST; static final String LATEST; }### Answer:
@Test public synchronized void testMatchFilter() { String[] addrList = {"address1", "address2"}; String[] topList = {"top1", "top2"}; Map topMap = new HashMap<String, String>(); List<byte[]> addressList = new ArrayList<>(); addressList.add(addrList[0].getBytes()); addressList.add(addrList[1].getBytes()); topMap.put("1", topList[0]); topMap.put("2", topList[1]); LogEventWrapper event = new LogEventWrapper(); ((LogEventWrapper) event).setTopicList(addressList); ((LogEventWrapper) event).setData(new byte[]{}); ((LogEventWrapper) event).setEventSignature(""); ((LogEventWrapper) event).setAbiEntry(Entry.newBuilder().setName("testABI").build()); event.setBlockNumber(new Long(123)); ContractEventTriggerCapsule capsule = new ContractEventTriggerCapsule(event); capsule.getContractEventTrigger().setContractAddress("address1"); capsule.getContractEventTrigger().setTopicMap(topMap); { Assert.assertEquals(true, matchFilter(capsule.getContractEventTrigger())); } { FilterQuery filterQuery = new FilterQuery(); filterQuery.setFromBlock(1); filterQuery.setToBlock(100); EventPluginLoader.getInstance().setFilterQuery(filterQuery); Assert.assertEquals(false, matchFilter(capsule.getContractEventTrigger())); } { FilterQuery filterQuery = new FilterQuery(); filterQuery.setFromBlock(133); filterQuery.setToBlock(190); EventPluginLoader.getInstance().setFilterQuery(filterQuery); Assert.assertEquals(false, matchFilter(capsule.getContractEventTrigger())); } { FilterQuery filterQuery = new FilterQuery(); filterQuery.setFromBlock(100); filterQuery.setToBlock(190); filterQuery.setContractAddressList(Arrays.asList(addrList)); filterQuery.setContractTopicList(Arrays.asList(topList)); EventPluginLoader.getInstance().setFilterQuery(filterQuery); Assert.assertEquals(true, matchFilter(capsule.getContractEventTrigger())); } }