Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite6bee19

Browse files
committed
[2.0.0]
BasicProvider simplifiedStatisticPriceApiTests assert fixed
1 parentb05bd8a commite6bee19

File tree

2 files changed

+4
-28
lines changed

2 files changed

+4
-28
lines changed

‎src/main/java/io/goodforgod/api/etherscan/BasicProvider.java‎

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
packageio.goodforgod.api.etherscan;
22

3-
importio.goodforgod.api.etherscan.error.EtherScanException;
43
importio.goodforgod.api.etherscan.error.EtherScanParseException;
54
importio.goodforgod.api.etherscan.error.EtherScanRateLimitException;
65
importio.goodforgod.api.etherscan.error.EtherScanResponseException;
@@ -9,7 +8,6 @@
98
importio.goodforgod.api.etherscan.model.response.StringResponseTO;
109
importjava.net.URI;
1110
importjava.nio.charset.StandardCharsets;
12-
importjava.util.Map;
1311

1412
/**
1513
* Base provider for API Implementations
@@ -64,36 +62,14 @@ <T> T convert(byte[] json, Class<T> tClass) {
6462
}
6563

6664
finalStringjsonAsString =newString(json,StandardCharsets.UTF_8);
67-
try {
68-
finalMap<String,Object>map =converter.fromJson(json,Map.class);
69-
finalObjectresult =map.get("result");
70-
if (resultinstanceofString && ((String)result).startsWith(MAX_RATE_LIMIT_REACHED))
71-
thrownewEtherScanRateLimitException(((String)result));
72-
73-
thrownewEtherScanParseException(e.getMessage() +", for response: " +jsonAsString,e.getCause(),jsonAsString);
74-
}catch (EtherScanExceptionex) {
75-
throwex;
76-
}catch (Exceptionex) {
77-
thrownewEtherScanParseException(e.getMessage() +", for response: " +jsonAsString,e.getCause(),jsonAsString);
78-
}
65+
thrownewEtherScanParseException(e.getMessage() +", for response: " +jsonAsString,e.getCause(),jsonAsString);
7966
}
8067
}
8168

8269
byte[]getRequest(StringurlParameters) {
8370
queue.takeTurn();
8471
finalURIuri =URI.create(baseUrl +module +urlParameters);
85-
finalbyte[]result =executor.get(uri);
86-
if (result.length ==0) {
87-
finalStringResponseTOemptyResponse =StringResponseTO.builder()
88-
.withStatus("0")
89-
.withMessage("Server returned null value for GET request at URL - " +uri)
90-
.withResult("")
91-
.build();
92-
93-
thrownewEtherScanResponseException(emptyResponse,"Server returned null value for GET request at URL - " +uri);
94-
}
95-
96-
returnresult;
72+
returnexecutor.get(uri);
9773
}
9874

9975
byte[]postRequest(StringurlParameters,StringdataToPost) {

‎src/test/java/io/goodforgod/api/etherscan/statistic/StatisticPriceApiTests.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ void correct() {
1616
assertNotNull(price);
1717
assertNotNull(price.btcTimestamp());
1818
assertNotNull(price.usdTimestamp());
19-
assertNotEquals(0.0,price.inBtc());
20-
assertNotEquals(0.0,price.inUsd());
19+
assertNotEquals(0.0,price.inBtc().doubleValue());
20+
assertNotEquals(0.0,price.inUsd().doubleValue());
2121
assertNotNull(price.toString());
2222

2323
Priceempty =Price.builder().build();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp