RepositoryEntityListener implements EntityListener { @Override public void onToken(Token token) throws ImporterException { tokenRepository.save(token); }  @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 onToken() throws ImporterException, DecoderException { var instr = "0011223344556677889900aabbccddeeff0011223344556677889900aabbccddeeff"; var input = Key.newBuilder().setEd25519(ByteString.copyFrom(Hex.decodeHex(instr))).build(); Token token = new Token(); token.setCreatedTimestamp(1L); token.setDecimals(1000); token.setFreezeDefault(false); token.setFreezeKey(input.toByteArray()); token.setInitialSupply(1_000_000_000L); token.setKycKey(input.toByteArray()); token.setModifiedTimestamp(3L); token.setName("FOO COIN TOKEN"); token.setSupplyKey(input.toByteArray()); token.setSymbol("FOOTOK"); token.setTokenId(new Token.Id(TOKEN_ID)); token.setTreasuryAccountId(ENTITY_ID); token.setWipeKey(input.toByteArray()); repositoryEntityListener.onToken(token); assertThat(tokenRepository.findAll()).contains(token); }