Search in sources :

Example 1 with ConstructionHashRequest

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

the class ConstructionHashHandlerTest method handling_construction_hash_should_return_hash.

@Test
public void handling_construction_hash_should_return_hash() throws Exception {
    // Arrange
    start();
    // Act
    var txn = Txn.create(Bytes.fromHexString("deadbeef"));
    var request = new ConstructionHashRequest().networkIdentifier(new NetworkIdentifier().network("localnet")).signedTransaction("deadbeef");
    var response = handleRequestWithExpectedResponse(sut, request, ConstructionHashResponse.class);
    // Assert
    assertThat(response.getTransactionIdentifier()).isEqualTo(coreModelMapper.transactionIdentifier(txn.getId()));
}
Also used : ConstructionHashRequest(com.radixdlt.api.core.openapitools.model.ConstructionHashRequest) NetworkIdentifier(com.radixdlt.api.core.openapitools.model.NetworkIdentifier) ApiTest(com.radixdlt.api.ApiTest) Test(org.junit.Test)

Example 2 with ConstructionHashRequest

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

the class ConstructionHashHandlerTest method invalid_hex_should_throw.

@Test
public void invalid_hex_should_throw() throws Exception {
    // Arrange
    start();
    // Act
    var request = new ConstructionHashRequest().networkIdentifier(new NetworkIdentifier().network("localnet")).signedTransaction("this_is_not_hex");
    var response = handleRequestWithExpectedResponse(sut, request, UnexpectedError.class);
    // Assert
    assertThat(response.getDetails()).isInstanceOf(InvalidHexError.class);
}
Also used : ConstructionHashRequest(com.radixdlt.api.core.openapitools.model.ConstructionHashRequest) NetworkIdentifier(com.radixdlt.api.core.openapitools.model.NetworkIdentifier) ApiTest(com.radixdlt.api.ApiTest) Test(org.junit.Test)

Aggregations

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