Search in sources :

Example 1 with PublicKey

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

the class ConstructionDeriveHandlerTest method invalid_public_key_should_throw_exception.

@Test
public void invalid_public_key_should_throw_exception() {
    // Arrange
    start();
    // Act
    // Assert
    var request = new ConstructionDeriveRequest().networkIdentifier(new NetworkIdentifier().network("localnet")).publicKey(new PublicKey().hex("deadbeaddeadbead")).metadata(new ConstructionDeriveRequestMetadataToken().symbol("test").type("Token"));
    assertThatThrownBy(() -> sut.handleRequest(request)).isInstanceOfSatisfying(CoreApiException.class, e -> {
        var error = e.toError();
        assertThat(error.getDetails()).isInstanceOf(InvalidPublicKeyError.class);
        assertThat(error.getCode()).isEqualTo(CoreApiErrorCode.BAD_REQUEST.getErrorCode());
    });
}
Also used : PublicKey(com.radixdlt.api.core.openapitools.model.PublicKey) NetworkIdentifier(com.radixdlt.api.core.openapitools.model.NetworkIdentifier) ConstructionDeriveRequest(com.radixdlt.api.core.openapitools.model.ConstructionDeriveRequest) ConstructionDeriveRequestMetadataToken(com.radixdlt.api.core.openapitools.model.ConstructionDeriveRequestMetadataToken) ApiTest(com.radixdlt.api.ApiTest) Test(org.junit.Test)

Aggregations

ApiTest (com.radixdlt.api.ApiTest)1 ConstructionDeriveRequest (com.radixdlt.api.core.openapitools.model.ConstructionDeriveRequest)1 ConstructionDeriveRequestMetadataToken (com.radixdlt.api.core.openapitools.model.ConstructionDeriveRequestMetadataToken)1 NetworkIdentifier (com.radixdlt.api.core.openapitools.model.NetworkIdentifier)1 PublicKey (com.radixdlt.api.core.openapitools.model.PublicKey)1 Test (org.junit.Test)1