Search in sources :

Example 1 with SubEntity

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

the class EntityHandlerTest method retrieve_invalid_sub_entity_should_throw.

@Test
public void retrieve_invalid_sub_entity_should_throw() throws Exception {
    // Arrange
    start();
    // Act
    var address = REAddr.ofPubKeyAccount(selfKey());
    var invalidSubEntity = coreModelMapper.entityIdentifier(address).subEntity(new SubEntity().address("prepared_stakes"));
    var request = new EntityRequest().networkIdentifier(new NetworkIdentifier().network("localnet")).entityIdentifier(invalidSubEntity);
    var response = handleRequestWithExpectedResponse(sut, request, UnexpectedError.class);
    // Assert
    assertThat(response.getDetails()).isInstanceOf(InvalidSubEntityError.class);
}
Also used : EntityRequest(com.radixdlt.api.core.openapitools.model.EntityRequest) NetworkIdentifier(com.radixdlt.api.core.openapitools.model.NetworkIdentifier) SubEntity(com.radixdlt.api.core.openapitools.model.SubEntity) ApiTest(com.radixdlt.api.ApiTest) Test(org.junit.Test)

Example 2 with SubEntity

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

the class ConstructionBuildTransferStakeUnstakeTest method withdrawing_staked_tokens_should_fail.

@Test
public void withdrawing_staked_tokens_should_fail() throws Exception {
    // Arrange
    start();
    // Act
    var request = buildTransfer(coreModelMapper.nativeToken(), getStakeAmount().toSubunits(), coreModelMapper.entityIdentifier(self).subEntity(new SubEntity().address("system")), coreModelMapper.entityIdentifier(REAddr.ofPubKeyAccount(self)));
    var response = handleRequestWithExpectedResponse(sut, request, UnexpectedError.class);
    // Assert
    assertThat(response.getDetails()).isInstanceOf(ResourceWithdrawOperationNotSupportedByEntityError.class);
}
Also used : SubEntity(com.radixdlt.api.core.openapitools.model.SubEntity) ApiTest(com.radixdlt.api.ApiTest) Test(org.junit.Test)

Aggregations

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