Search in sources :

Example 1 with ChainInfoDTO

use of io.nem.symbol.sdk.openapi.okhttp_gson.model.ChainInfoDTO 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());
}
Also used : FinalizedBlockDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.FinalizedBlockDTO) ChainInfo(io.nem.symbol.sdk.model.blockchain.ChainInfo) ChainInfoDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.ChainInfoDTO) Test(org.junit.jupiter.api.Test)

Aggregations

ChainInfo (io.nem.symbol.sdk.model.blockchain.ChainInfo)1 ChainInfoDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.ChainInfoDTO)1 FinalizedBlockDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.FinalizedBlockDTO)1 Test (org.junit.jupiter.api.Test)1