### Question:
TimelinessValidator { public boolean addTxHash(byte[] txHash,long ancestorBlockNum,byte[] ancestorBlockHash){ if(this.validateTxHash(txHash,ancestorBlockNum,ancestorBlockHash)){ pendingTxCache.add(new ByteArrayWrapper(txHash)); return true; } return false; } TimelinessValidator();  TimelinessValidator(Map<Long,ValidateBlock> map, long maxAncestorBlockNum); boolean validateBlockHash(byte[] blockHash,long ancestorBlockNum,byte[] ancestorBlockHash); boolean addBlockHash(byte[] blockHash, long ancestorBlockNum, byte[] ancestorBlockHash, HashSet<ByteArrayWrapper> txSet); boolean addAncestorBlockHash(byte[] blockHash,long blockNum,byte[] ancestorBlockHash,long ancestorBlockNum,HashSet<ByteArrayWrapper> txSet); boolean validateTxHash(byte[] txHash,long ancestorBlockNum,byte[] ancestorBlockHash); boolean addTxHash(byte[] txHash,long ancestorBlockNum,byte[] ancestorBlockHash);  }### Answer:
@Test public void addTxHash() { TimelinessValidator timelinessValidator = this.addHash(); Assert.assertTrue(timelinessValidator.addTxHash(txHash2,ancestorBlockNum,ancestorBlockHash)); Assert.assertFalse(timelinessValidator.addTxHash(txHash2,ancestorBlockNum,ancestorBlockHash)); }