From c0e1b617cffe333799fca7c5c2280bfdfff97ddf Mon Sep 17 00:00:00 2001 From: Miles-Garnsey Date: Tue, 26 Sep 2023 15:49:16 +1000 Subject: [PATCH] Another fix to job status tests to accomodate new types. --- .../datastax/mgmtapi/NonDestructiveOpsIT.java | 30 +++++++------------ 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/management-api-server/src/test/java/com/datastax/mgmtapi/NonDestructiveOpsIT.java b/management-api-server/src/test/java/com/datastax/mgmtapi/NonDestructiveOpsIT.java index 0d86a627..4d13dbf7 100644 --- a/management-api-server/src/test/java/com/datastax/mgmtapi/NonDestructiveOpsIT.java +++ b/management-api-server/src/test/java/com/datastax/mgmtapi/NonDestructiveOpsIT.java @@ -794,16 +794,14 @@ public void testAsyncRepair() throws IOException, URISyntaxException, Interrupte return; } assertThat(getJobDetailsResponse.getLeft()).isEqualTo(HttpStatus.SC_OK); - Map jobDetails = + Job jobDetails = new JsonMapper() .readValue( getJobDetailsResponse.getRight(), - new TypeReference>() {}); - assertThat(jobDetails) - .hasEntrySatisfying("id", value -> assertThat(value).isEqualTo(jobId)) - .hasEntrySatisfying("type", value -> assertThat(value).isEqualTo("repair")) - .hasEntrySatisfying( - "status", value -> assertThat(value).isIn("COMPLETED", "ERROR")); + new TypeReference() {}); + assertThat(jobDetails.getJobId()).isEqualTo(jobId); + assertThat(jobDetails.getJobType()).isEqualTo("repair"); + assertThat(jobDetails.getStatus()).isIn("COMPLETED", "ERROR"); }); } @@ -1019,18 +1017,12 @@ public void testMoveNode() throws IOException, URISyntaxException { .thenApply(this::responseAsCodeAndBody) .join(); assertThat(getJobDetailsResponse.getLeft()).isEqualTo(HttpStatus.SC_OK); - Map jobDetails = + Job jobDetails = new JsonMapper() - .readValue( - getJobDetailsResponse.getRight(), - new TypeReference>() {}); - assertThat(jobDetails) - .hasEntrySatisfying("id", value -> assertThat(value).isEqualTo(jobId)) - .hasEntrySatisfying("type", value -> assertThat(value).isEqualTo("move")) - // if the server has only one token, the job will be completed, otherwise it will - // end up in error - .hasEntrySatisfying( - "status", value -> assertThat(value).isIn("COMPLETED", "ERROR")); + .readValue(getJobDetailsResponse.getRight(), new TypeReference() {}); + assertThat(jobDetails.getJobId()).isEqualTo(jobId); + assertThat(jobDetails.getJobType()).isEqualTo("move"); + assertThat(jobDetails.getStatus()).isIn("COMPLETED", "ERROR"); }); } -} +} \ No newline at end of file