Search in sources :

Example 1 with EntityIdentifier

use of com.radixdlt.api.core.openapitools.model.EntityIdentifier in project radixdlt by radixdlt.

the class EntityHandlerTest method retrieve_system_entity_on_genesis.

@Test
public void retrieve_system_entity_on_genesis() throws Exception {
    // Arrange
    start();
    // Act
    var request = new EntityRequest().networkIdentifier(new NetworkIdentifier().network("localnet")).entityIdentifier(new EntityIdentifier().address("system"));
    var response = handleRequestWithExpectedResponse(sut, request, EntityResponse.class);
    // Assert
    var stateAccumulator = response.getStateIdentifier().getTransactionAccumulator();
    var genesisAccumulator = genesis.getProof().getAccumulatorState().getAccumulatorHash().asBytes();
    assertThat(stateAccumulator).isEqualTo(Bytes.toHexString(genesisAccumulator));
    assertThat(response.getBalances()).isEmpty();
    assertThat(response.getDataObjects()).isNotEmpty();
}
Also used : EntityRequest(com.radixdlt.api.core.openapitools.model.EntityRequest) NetworkIdentifier(com.radixdlt.api.core.openapitools.model.NetworkIdentifier) EntityIdentifier(com.radixdlt.api.core.openapitools.model.EntityIdentifier) ApiTest(com.radixdlt.api.ApiTest) Test(org.junit.Test)

Example 2 with EntityIdentifier

use of com.radixdlt.api.core.openapitools.model.EntityIdentifier in project radixdlt by radixdlt.

the class EntityHandlerTest method retrieve_invalid_entity_should_throw.

@Test
public void retrieve_invalid_entity_should_throw() throws Exception {
    // Arrange
    start();
    // Act
    // Assert
    var request = new EntityRequest().networkIdentifier(new NetworkIdentifier().network("localnet")).entityIdentifier(new EntityIdentifier().address("some_garbage_address"));
    var response = handleRequestWithExpectedResponse(sut, request, UnexpectedError.class);
    assertThat(response.getDetails()).isInstanceOf(InvalidAddressError.class);
}
Also used : EntityRequest(com.radixdlt.api.core.openapitools.model.EntityRequest) NetworkIdentifier(com.radixdlt.api.core.openapitools.model.NetworkIdentifier) EntityIdentifier(com.radixdlt.api.core.openapitools.model.EntityIdentifier) ApiTest(com.radixdlt.api.ApiTest) Test(org.junit.Test)

Aggregations

ApiTest (com.radixdlt.api.ApiTest)2 EntityIdentifier (com.radixdlt.api.core.openapitools.model.EntityIdentifier)2 EntityRequest (com.radixdlt.api.core.openapitools.model.EntityRequest)2 NetworkIdentifier (com.radixdlt.api.core.openapitools.model.NetworkIdentifier)2 Test (org.junit.Test)2