Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #65 from blockchain/fix_explorer_tests
Browse files Browse the repository at this point in the history
Fix explorer tests
  • Loading branch information
tduriez-bc authored May 21, 2021
2 parents 08c1043 + ac75135 commit de2aeff
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 34 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ repositories {
...
dependencies {
...
compile 'info.blockchain:api:1.1.5'
compile 'info.blockchain:api:2.0.2'
}
...
```
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>info.blockchain</groupId>
<artifactId>api</artifactId>
<version>2.0.1</version>
<version>2.0.2</version>
<packaging>jar</packaging>

<name>api</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ public void getAddress () throws Exception {
assertEquals("07feead7f9fb7d16a0251421ac9fa090169cc169",
address.getHash160());
assertEquals(0, address.getFinalBalance());
assertEquals(2, address.getTxCount());
assertEquals(20000, address.getTotalReceived());
assertEquals(20000, address.getTotalSent());
assertEquals(2, address.getTransactions().size());
assertEquals(16, address.getTxCount());
assertEquals(605204 , address.getTotalReceived());
assertEquals(605204 , address.getTotalSent());
assertEquals(10, address.getTransactions().size());
}

@Test
Expand All @@ -58,38 +58,13 @@ public void getBalance () throws Exception {
Map<String, Balance> balances = client.getBalance(list, FilterType.All);

assertEquals(0, balances.get(address1).getFinalBalance());
assertEquals(2, balances.get(address1).getTxCount());
assertEquals(20000, balances.get(address1).getTotalReceived());
assertEquals(16, balances.get(address1).getTxCount());
assertEquals(605204, balances.get(address1).getTotalReceived());
assertEquals(20000, balances.get(address2).getFinalBalance());
assertEquals(1, balances.get(address2).getTxCount());
assertEquals(20000, balances.get(address2).getTotalReceived());
}

@Test
public void getMultiAddress () throws Exception {
String address1 = "1jH7K4RJrQBXijtLj1JpzqPRhR7MdFtaW";
String address2 = "xpub6CmZamQcHw2TPtbGmJNEvRgfhLwitarvzFn3fBYEEkFTqztus7W7CNbf48Kxuj1bRRBmZPzQocB6qar9ay6buVkQk73ftKE1z4tt9cPHWRn";
List<String> list = Arrays.asList(address1, address2);
MultiAddress multiAddress = client.getMultiAddress(list, FilterType.All, null, null);

//Addresses
assertEquals("1jH7K4RJrQBXijtLj1JpzqPRhR7MdFtaW", multiAddress.getAddresses().get(0).getAddress());
assertEquals(2, multiAddress.getAddresses().get(0).getTxCount());
assertEquals(20000, multiAddress.getAddresses().get(0).getTotalReceived());
assertEquals(20000, multiAddress.getAddresses().get(0).getTotalSent());
assertEquals(0, multiAddress.getAddresses().get(0).getFinalBalance());

assertEquals("xpub6CmZamQcHw2TPtbGmJNEvRgfhLwitarvzFn3fBYEEkFTqztus7W7CNbf48Kxuj1bRRBmZPzQocB6qar9ay6buVkQk73ftKE1z4tt9cPHWRn", multiAddress
.getAddresses().get(1).getAddress());
assertEquals(1, multiAddress.getAddresses().get(1).getTxCount());
assertEquals(20000, multiAddress.getAddresses().get(1).getTotalReceived());
assertEquals(0, multiAddress.getAddresses().get(1).getTotalSent());
assertEquals(20000, multiAddress.getAddresses().get(1).getFinalBalance());
assertEquals(0, multiAddress.getAddresses().get(1).getChangeIndex());
assertEquals(1, multiAddress.getAddresses().get(1).getAccountIndex());
assertEquals(20, multiAddress.getAddresses().get(1).getGapLimit());
}

@Test
public void getXpub () throws Exception {
String address = "xpub6CmZamQcHw2TPtbGmJNEvRgfhLwitarvzFn3fBYEEkFTqztus7W7CNbf48Kxuj1bRRBmZPzQocB6qar9ay6buVkQk73ftKE1z4tt9cPHWRn";
Expand All @@ -103,7 +78,7 @@ public void getXpub () throws Exception {
assertEquals(20000, xpub.getFinalBalance());
assertEquals(0, xpub.getChangeIndex());
assertEquals(1, xpub.getAccountIndex());
assertEquals(20, xpub.getGapLimit());
assertEquals(0, xpub.getGapLimit());
}

}

0 comments on commit de2aeff

Please sign in to comment.