Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
alfonsobries committed Aug 22, 2024
1 parent 89375fd commit 4914d31
Show file tree
Hide file tree
Showing 16 changed files with 36 additions and 38 deletions.
3 changes: 2 additions & 1 deletion src/main/java/org/arkecosystem/client/ArkClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ public class ArkClient {
/**
* Constructor to create an instance of ArkClient.
*
* @param hostOrHosts Can be a string representing the host URL or a map with different types of hosts.
* @param hostOrHosts Can be a string representing the host URL or a map with different types of
* hosts.
*/
public ArkClient(Object hostOrHosts) {
this.client = new Client(hostOrHosts);
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/org/arkecosystem/client/ClientManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ public void disconnect(String name) {
this.clients.remove(name);
}

/**
* Disconnect from the default client.
*/
/** Disconnect from the default client. */
public void disconnect() {
disconnect(null);
}
Expand Down
7 changes: 4 additions & 3 deletions src/test/java/org/arkecosystem/client/ArkClientTest.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package org.arkecosystem.client;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.HashMap;
import java.util.Map;

import org.junit.jupiter.api.Test;

class ArkClientTest {
Expand Down Expand Up @@ -63,6 +62,8 @@ void shouldSetHost() {
void shouldThrowExceptionIfHostTypeIsInvalid() {
ArkClient client = new ArkClient("https://old-host.com/api");

assertThrows(IllegalArgumentException.class, () -> client.setHost("https://new-host.com/api", "other"));
assertThrows(
IllegalArgumentException.class,
() -> client.setHost("https://new-host.com/api", "other"));
}
}
18 changes: 11 additions & 7 deletions src/test/java/org/arkecosystem/client/ClientManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ public void shouldThrowIfClientAlreadyExists() {
ClientManager manager = new ClientManager();
manager.connect(map.get("host").toString(), "dummy-client");

assertThrows(IllegalArgumentException.class, () -> {
manager.connect(map.get("host").toString(), "dummy-client");
});
assertThrows(
IllegalArgumentException.class,
() -> {
manager.connect(map.get("host").toString(), "dummy-client");
});
}

@Test
Expand Down Expand Up @@ -59,9 +61,11 @@ public void client() {
public void shouldThrowIfClientDoesNotExist() {
ClientManager manager = new ClientManager();

assertThrows(IllegalArgumentException.class, () -> {
manager.client("non-existent-client");
});
assertThrows(
IllegalArgumentException.class,
() -> {
manager.client("non-existent-client");
});
}

@Test
Expand Down Expand Up @@ -98,4 +102,4 @@ public void getClients() {

assertEquals(0, manager.getClients().size());
}
}
}
2 changes: 1 addition & 1 deletion src/test/java/org/arkecosystem/client/MockHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ public static ArkClient client() {

return client;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ void allWithParams() throws IOException {
client.api().apiNodes.param("page", 1).param("limit", 100).all();
assertTrue((boolean) actual.get("success"));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ void all() throws IOException {
Map<String, Object> actual = client.api().blockchain.all();
assertTrue((boolean) actual.get("success"));
}
}
}
5 changes: 2 additions & 3 deletions src/test/java/org/arkecosystem/client/api/BlocksTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ void all() throws IOException {
@Test
void allWithParams() throws IOException {
ArkClient client = MockHelper.client();
Map<String, Object> actual =
client.api().blocks.param("page", 1).param("limit", 100).all();
Map<String, Object> actual = client.api().blocks.param("page", 1).param("limit", 100).all();
assertTrue((boolean) actual.get("success"));
}

Expand Down Expand Up @@ -60,4 +59,4 @@ void transactionsWithParams() throws IOException {
client.api().blocks.param("page", 1).param("limit", 100).transactions("dummy");
assertTrue((boolean) actual.get("success"));
}
}
}
2 changes: 1 addition & 1 deletion src/test/java/org/arkecosystem/client/api/CommitsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ void show() throws IOException {
Map<String, Object> actual = client.api().commits.show(123456);
assertTrue((boolean) actual.get("success"));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ void votersWithParams() throws IOException {
client.api().delegates.param("page", 1).param("limit", 100).voters("dummy");
assertTrue((boolean) actual.get("success"));
}
}
}
2 changes: 1 addition & 1 deletion src/test/java/org/arkecosystem/client/api/NodeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ void crypto() throws IOException {
Map<String, Object> actual = client.api().node.crypto();
assertTrue((boolean) actual.get("success"));
}
}
}
5 changes: 2 additions & 3 deletions src/test/java/org/arkecosystem/client/api/PeersTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ void all() throws IOException {
@Test
void allWithParams() throws IOException {
ArkClient client = MockHelper.client();
Map<String, Object> actual =
client.api().peers.param("page", 1).param("limit", 100).all();
Map<String, Object> actual = client.api().peers.param("page", 1).param("limit", 100).all();
assertTrue((boolean) actual.get("success"));
}

Expand All @@ -31,4 +30,4 @@ void show() throws IOException {
Map<String, Object> actual = client.api().peers.show("dummy");
assertTrue((boolean) actual.get("success"));
}
}
}
5 changes: 2 additions & 3 deletions src/test/java/org/arkecosystem/client/api/RoundsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ void all() throws IOException {
@Test
void allWithParams() throws IOException {
ArkClient client = MockHelper.client();
Map<String, Object> actual =
client.api().rounds.param("page", 1).param("limit", 100).all();
Map<String, Object> actual = client.api().rounds.param("page", 1).param("limit", 100).all();
assertTrue((boolean) actual.get("success"));
}

Expand All @@ -38,4 +37,4 @@ void show() throws IOException {
Map<String, Object> actual = client.api().rounds.show(12345);
assertTrue((boolean) actual.get("success"));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ void allUnconfirmed() throws IOException {
@Test
void allUnconfirmedWithParams() throws IOException {
ArkClient client = MockHelper.client();
Map<String, Object> actual =
client.api().transactions.param("page", 1).allUnconfirmed();
Map<String, Object> actual = client.api().transactions.param("page", 1).allUnconfirmed();
assertTrue((boolean) actual.get("success"));
}

Expand Down Expand Up @@ -82,4 +81,4 @@ void schemas() throws IOException {
Map<String, Object> actual = client.api().transactions.schemas();
assertTrue((boolean) actual.get("success"));
}
}
}
5 changes: 2 additions & 3 deletions src/test/java/org/arkecosystem/client/api/VotesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ void all() throws IOException {
@Test
void allWithParams() throws IOException {
ArkClient client = MockHelper.client();
Map<String, Object> actual =
client.api().votes.param("page", 1).param("limit", 100).all();
Map<String, Object> actual = client.api().votes.param("page", 1).param("limit", 100).all();
assertTrue((boolean) actual.get("success"));
}

Expand All @@ -31,4 +30,4 @@ void show() throws IOException {
Map<String, Object> actual = client.api().votes.show("dummy");
assertTrue((boolean) actual.get("success"));
}
}
}
5 changes: 2 additions & 3 deletions src/test/java/org/arkecosystem/client/api/WalletsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ void transactions() throws IOException {
@Test
void transactionsWithParams() throws IOException {
ArkClient client = MockHelper.client();
Map<String, Object> actual =
client.api().wallets.param("page", 1).transactions("dummy");
Map<String, Object> actual = client.api().wallets.param("page", 1).transactions("dummy");
assertTrue((boolean) actual.get("success"));
}

Expand Down Expand Up @@ -104,4 +103,4 @@ void topWithParams() throws IOException {
Map<String, Object> actual = client.api().wallets.param("page", 1).top();
assertTrue((boolean) actual.get("success"));
}
}
}

0 comments on commit 4914d31

Please sign in to comment.