RepositoryEntityListener implements EntityListener { @Override public void onTopicMessage(TopicMessage topicMessage) throws ImporterException { topicMessageRepository.save(topicMessage); }  @Override boolean isEnabled(); @Override void onContractResult(ContractResult contractResult); @Override void onCryptoTransfer(CryptoTransfer cryptoTransfer); @Override void onEntityId(EntityId entityId); @Override void onFileData(FileData fileData); @Override void onLiveHash(LiveHash liveHash); @Override void onNonFeeTransfer(NonFeeTransfer nonFeeTransfer); @Override void onToken(Token token); @Override void onTokenAccount(TokenAccount tokenAccount); @Override void onTokenTransfer(TokenTransfer tokenTransfer); @Override void onTopicMessage(TopicMessage topicMessage); @Override void onTransaction(Transaction transaction);  }
@Test void onTopicMessage() { TopicMessage topicMessage = new TopicMessage(); topicMessage.setConsensusTimestamp(1L); topicMessage.setMessage(new byte[] {'a'}); topicMessage.setRealmNum(0); topicMessage.setRunningHash(new byte[] {'b'}); topicMessage.setRunningHashVersion(2); topicMessage.setSequenceNumber(1); topicMessage.setTopicNum(1); repositoryEntityListener.onTopicMessage(topicMessage); assertThat(topicMessageRepository.findAll()).contains(topicMessage); }