use of io.nem.symbol.sdk.api.HashLockRepository in project nem2-sdk-java by nemtech.
the class StateProofServiceTest method hashLock.
@Test
void hashLock() throws Exception {
HashLockRepository repository = mock(HashLockRepository.class);
when(factory.createHashLockRepository()).thenReturn(repository);
String id = "hash";
HashLockInfo state = Mockito.mock(HashLockInfo.class);
when(state.getHash()).thenReturn(id);
when(state.serialize()).thenReturn(ConvertUtils.fromHexToBytes(serialized));
when(repository.getHashLock(eq(id))).thenReturn(Observable.just(state));
when(repository.getHashLockMerkle(eq(id))).thenReturn(Observable.just(tree));
StateMerkleProof<HashLockInfo> proof = service.hashLock(id).toFuture().get();
Assertions.assertTrue(proof.isValid());
Assertions.assertEquals(state, proof.getState());
}
Aggregations