diff --git a/backend/src/main/java/djmil/cordacheckers/cordaclient/CordaClient.java b/backend/src/main/java/djmil/cordacheckers/cordaclient/CordaClient.java index b7d110e..2553ae7 100644 --- a/backend/src/main/java/djmil/cordacheckers/cordaclient/CordaClient.java +++ b/backend/src/main/java/djmil/cordacheckers/cordaclient/CordaClient.java @@ -11,7 +11,7 @@ import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; import djmil.cordacheckers.cordaclient.dao.VirtualNode; -import djmil.cordacheckers.cordaclient.dao.VirtualNodes; +import djmil.cordacheckers.cordaclient.dao.VirtualNodeList; @Service public class CordaClient { @@ -33,11 +33,11 @@ public class CordaClient { // Request final HttpEntity request = new HttpEntity<>(headers); - ResponseEntity resp = this.restTemplate.exchange( + ResponseEntity resp = this.restTemplate.exchange( "https://localhost:8888/api/v1/virtualnode", HttpMethod.GET, request, - VirtualNodes.class ); + VirtualNodeList.class ); // TODO: throw exeption instead if (resp.getStatusCode() != HttpStatus.OK || !resp.hasBody()) { diff --git a/backend/src/main/java/djmil/cordacheckers/cordaclient/dao/VirtualNodes.java b/backend/src/main/java/djmil/cordacheckers/cordaclient/dao/VirtualNodeList.java similarity index 72% rename from backend/src/main/java/djmil/cordacheckers/cordaclient/dao/VirtualNodes.java rename to backend/src/main/java/djmil/cordacheckers/cordaclient/dao/VirtualNodeList.java index 538a789..2e4ad6d 100644 --- a/backend/src/main/java/djmil/cordacheckers/cordaclient/dao/VirtualNodes.java +++ b/backend/src/main/java/djmil/cordacheckers/cordaclient/dao/VirtualNodeList.java @@ -5,4 +5,4 @@ import java.util.List; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @JsonIgnoreProperties(ignoreUnknown = true) -public record VirtualNodes(List virtualNodes) { } +public record VirtualNodeList(List virtualNodes) { } diff --git a/backend/src/test/java/djmil/cordacheckers/CordacheckersApplicationTests.java b/backend/src/test/java/djmil/cordacheckers/CordacheckersApplicationTests.java index 2d1ec5f..5d7929e 100644 --- a/backend/src/test/java/djmil/cordacheckers/CordacheckersApplicationTests.java +++ b/backend/src/test/java/djmil/cordacheckers/CordacheckersApplicationTests.java @@ -28,6 +28,7 @@ import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.web.client.RestTemplate; import djmil.cordacheckers.cordaclient.dao.HoldingIdentity; +import djmil.cordacheckers.cordaclient.dao.VirtualNodeList; import djmil.cordacheckers.cordaclient.dao.VirtualNodes; import static org.assertj.core.api.Assertions.assertThat; @@ -80,19 +81,19 @@ class CordacheckersApplicationTests { // Request final HttpEntity request = new HttpEntity<>(headers); - final ResponseEntity response = new RestTemplate(requestFactory) - .exchange("https://localhost:8888/api/v1/virtualnode", HttpMethod.GET, request, VirtualNodes.class); + final ResponseEntity response = new RestTemplate(requestFactory) + .exchange("https://localhost:8888/api/v1/virtualnode", HttpMethod.GET, request, VirtualNodeList.class); assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(response.hasBody()); - VirtualNodes vNode = response.getBody(); - assertThat(vNode).isNotNull(); - if (vNode != null) { - assertThat(vNode.virtualNodes().size() == 5); + VirtualNodeList vNodeList = response.getBody(); + assertThat(vNodeList).isNotNull(); + if (vNodeList != null) { + assertThat(vNodeList.virtualNodes().size() == 5); } - HoldingIdentity identity = vNode.virtualNodes().get(0).holdingIdentity(); + HoldingIdentity identity = vNodeList.virtualNodes().get(0).holdingIdentity(); assertThat(identity.x500Name().contains("NotaryRep1")); } }