use of io.nem.symbol.sdk.model.blockchain.ChainInfo in project nem2-sdk-java by nemtech.
the class ChainRepositoryOkHttpImplTest method shouldGetBlockchainScore.
@Test
public void shouldGetBlockchainScore() throws Exception {
ChainInfoDTO dto = new ChainInfoDTO();
dto.setScoreLow(BigInteger.valueOf(1));
dto.setScoreHigh(BigInteger.valueOf(2));
dto.setHeight(BigInteger.valueOf(3));
dto.latestFinalizedBlock(new FinalizedBlockDTO().hash("abc").height(BigInteger.valueOf(6)).finalizationEpoch(7L).finalizationPoint(8L));
mockRemoteCall(dto);
ChainInfo chainInfo = repository.getChainInfo().toFuture().get();
Assertions.assertEquals((dto.getScoreLow()), chainInfo.getScoreLow());
Assertions.assertEquals((dto.getScoreHigh()), chainInfo.getScoreHigh());
Assertions.assertEquals((dto.getHeight()), chainInfo.getHeight());
Assertions.assertEquals((dto.getLatestFinalizedBlock().getFinalizationPoint()), chainInfo.getLatestFinalizedBlock().getFinalizationPoint());
Assertions.assertEquals((dto.getLatestFinalizedBlock().getHeight()), chainInfo.getLatestFinalizedBlock().getHeight());
Assertions.assertEquals((dto.getLatestFinalizedBlock().getFinalizationEpoch()), chainInfo.getLatestFinalizedBlock().getFinalizationEpoch());
Assertions.assertEquals((dto.getLatestFinalizedBlock().getHash()), chainInfo.getLatestFinalizedBlock().getHash());
}
use of io.nem.symbol.sdk.model.blockchain.ChainInfo in project nem2-sdk-java by nemtech.
the class ChainRepositoryIntegrationTest method getChainInfo.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getChainInfo(RepositoryType type) {
ChainInfo chainInfo = get(getChainRepository(type).getChainInfo());
assertTrue(chainInfo.getScoreLow().longValue() >= 0);
assertTrue(chainInfo.getScoreHigh().longValue() >= 0);
assertTrue(chainInfo.getHeight().longValue() > 0);
FinalizedBlock finalizedBlock = chainInfo.getLatestFinalizedBlock();
assertTrue(finalizedBlock.getFinalizationEpoch() >= 0);
assertTrue(finalizedBlock.getFinalizationPoint() >= 0);
assertTrue(finalizedBlock.getHeight().longValue() > 0);
assertNotNull(finalizedBlock.getHash());
}
use of io.nem.symbol.sdk.model.blockchain.ChainInfo in project nem2-sdk-java by nemtech.
the class ChainRepositoryVertxImplTest method shouldGetBlockchainScore.
@Test
public void shouldGetBlockchainScore() throws Exception {
ChainInfoDTO dto = new ChainInfoDTO();
dto.setScoreLow(BigInteger.valueOf(1));
dto.setScoreHigh(BigInteger.valueOf(2));
dto.setHeight(BigInteger.valueOf(3));
dto.latestFinalizedBlock(new FinalizedBlockDTO().hash("abc").height(BigInteger.valueOf(6)).finalizationEpoch(7L).finalizationPoint(8L));
mockRemoteCall(dto);
ChainInfo chainInfo = repository.getChainInfo().toFuture().get();
Assertions.assertEquals((dto.getScoreLow()), chainInfo.getScoreLow());
Assertions.assertEquals((dto.getScoreHigh()), chainInfo.getScoreHigh());
Assertions.assertEquals((dto.getHeight()), chainInfo.getHeight());
Assertions.assertEquals((dto.getLatestFinalizedBlock().getFinalizationPoint()), chainInfo.getLatestFinalizedBlock().getFinalizationPoint());
Assertions.assertEquals((dto.getLatestFinalizedBlock().getHeight()), chainInfo.getLatestFinalizedBlock().getHeight());
Assertions.assertEquals((dto.getLatestFinalizedBlock().getFinalizationEpoch()), chainInfo.getLatestFinalizedBlock().getFinalizationEpoch());
Assertions.assertEquals((dto.getLatestFinalizedBlock().getHash()), chainInfo.getLatestFinalizedBlock().getHash());
}
Aggregations