Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
satran004 committed Oct 15, 2021
1 parent a824d7c commit cd778d3
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import com.bloxbean.cardano.client.backend.factory.BackendFactory;
import com.bloxbean.cardano.client.backend.impl.blockfrost.common.Constants;
import com.bloxbean.cardano.client.backend.model.Result;
import static org.hamcrest.Matchers.*;

import com.bloxbean.cardano.client.backend.model.metadata.MetadataCBORContent;
import com.bloxbean.cardano.client.backend.model.metadata.MetadataJSONContent;
import com.bloxbean.cardano.client.backend.model.metadata.MetadataLabel;
Expand All @@ -19,8 +17,10 @@

import java.math.BigInteger;
import java.util.List;
import java.util.stream.Collectors;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;

public class BFMetadataServiceIT extends BFBaseTest {

Expand All @@ -43,10 +43,13 @@ public void testGetCBORMetadataByTxnHash() throws ApiException {

System.out.println(JsonUtil.getPrettyJson(value));

List<String> labels = value.stream().map(v -> v.getLabel()).collect(Collectors.toList());
List<String> cborMetadata = value.stream().map(v -> v.getCborMetadata()).collect(Collectors.toList());

assertThat(value, Matchers.notNullValue());
assertThat(value, hasSize(5));
assertThat(value.get(0).getLabel(), is("197819781978"));
assertThat(value.get(0).getCborMetadata(), is("\\xa11b0000002e0efa535a644a6f686e"));
assertThat(labels, hasItem("197819781978"));
assertThat(cborMetadata, hasItem("\\xa11b0000002e0efa535a644a6f686e"));
}


Expand All @@ -60,11 +63,11 @@ public void testGetJSONMetadataByTxnHash() throws ApiException {

System.out.println(JsonUtil.getPrettyJson(value));

List<String> labels = value.stream().map(v -> v.getLabel()).collect(Collectors.toList());

assertThat(value, Matchers.notNullValue());
assertThat(value, hasSize(5));
assertThat(value.get(0).getLabel(), is("197819781978"));
assertThat(value.get(0).getJsonMetadata().asText(), is("John"));
assertThat(value.get(3).getJsonMetadata().get("197819").asText(), is("200001"));
assertThat(labels, hasItem("197819781978"));
}

@Test
Expand Down Expand Up @@ -94,15 +97,15 @@ public void testGetJSONMetadataByLabel() throws ApiException {

@Test
public void testGetCBORMetadataByLabel() throws ApiException {
Result<List<MetadataCBORContent>> result = metadataService.getCBORMetadataByLabel(new BigInteger("197819781978"), 10, 1, OrderEnum.asc);
Result<List<MetadataCBORContent>> result = metadataService.getCBORMetadataByLabel(new BigInteger("1985"), 10, 1, OrderEnum.asc);

List<MetadataCBORContent> value = result.getValue();

System.out.println(JsonUtil.getPrettyJson(value));

assertThat(value, Matchers.notNullValue());
assertThat(value, hasSize(10));
assertThat(value.get(0).getTxHash(), is("ca34aa6810382752c10ddbe8443f50242beddebafbb5df2f312753512325b071"));
assertThat(value.get(0).getTxHash(), is("c13c61a6e4da17482d1e79cb2eeed3e8c54a3edd23aad8722ad003be2d51d6e3"));
}

}

0 comments on commit cd778d3

Please sign in to comment.