diff --git a/application/aam-backend-service/src/test/kotlin/com/aamdigital/aambackendservice/e2e/CucumberIntegrationTest.kt b/application/aam-backend-service/src/test/kotlin/com/aamdigital/aambackendservice/e2e/CucumberIntegrationTest.kt index af0edb2..ecf06bc 100644 --- a/application/aam-backend-service/src/test/kotlin/com/aamdigital/aambackendservice/e2e/CucumberIntegrationTest.kt +++ b/application/aam-backend-service/src/test/kotlin/com/aamdigital/aambackendservice/e2e/CucumberIntegrationTest.kt @@ -49,25 +49,25 @@ class CucumberIntegrationTest : SpringIntegrationTest() { @Then("the client receives an json array") @Throws(Throwable::class) fun `the client receives list of values`() { - Assert.assertTrue(parseBodyToArrayNode()?.isArray ?: false) + Assert.assertEquals(true, parseBodyToArrayNode()?.isArray) } @When("the client receives an json object") @Throws(Throwable::class) fun `the client receives an json object`() { - Assert.assertTrue(parseBodyToObjectNode()?.isObject ?: false) + Assert.assertEquals(true, parseBodyToObjectNode()?.isObject) } @Then("the client receives status code of {int}") @Throws(Throwable::class) fun `the client receives status code of`(statusCode: Int) { - Assert.assertTrue(latestResponseStatus?.value() == statusCode) + Assert.assertEquals(statusCode, latestResponseStatus?.value()) } @Then("the client receives value {} for property {}") @Throws(Throwable::class) fun `the client receives value for property`(value: String, property: String) { - Assert.assertTrue(parseBodyToObjectNode()?.has(property) ?: false) + Assert.assertEquals(true, parseBodyToObjectNode()?.has(property)) Assert.assertEquals(value, parseBodyToObjectNode()?.get(property)?.textValue()) } diff --git a/application/aam-backend-service/src/test/resources/cucumber/features/reporting/report/report.feature b/application/aam-backend-service/src/test/resources/cucumber/features/reporting/report/report.feature index 764d2f2..5685926 100644 --- a/application/aam-backend-service/src/test/resources/cucumber/features/reporting/report/report.feature +++ b/application/aam-backend-service/src/test/resources/cucumber/features/reporting/report/report.feature @@ -1,4 +1,4 @@ -Feature: the report endpoint persist to database +Feature: the report endpoints persist to database Scenario: client makes call to GET /reporting/report and receives empty list Given database app is created @@ -9,6 +9,13 @@ Feature: the report endpoint persist to database Then the client receives status code of 200 Then the client receives array with 0 elements + Scenario: client makes call to GET /reporting/report without token and receives Unauthorized + Given database app is created + Given database report-calculation is created + When the client calls GET /v1/reporting/report + Then the client receives an json object + Then the client receives status code of 401 + Scenario: client makes call to GET /reporting/report/foo and receives not found Given database app is created Given database report-calculation is created diff --git a/application/aam-backend-service/src/test/resources/cucumber/features/reporting/reportcalculation/report-calculation.feature b/application/aam-backend-service/src/test/resources/cucumber/features/reporting/reportcalculation/report-calculation.feature new file mode 100644 index 0000000..4c0b12b --- /dev/null +++ b/application/aam-backend-service/src/test/resources/cucumber/features/reporting/reportcalculation/report-calculation.feature @@ -0,0 +1,19 @@ +Feature: the report calculation endpoint persist to database + + Scenario: client makes call to GET /reporting/report-calculation/report/ReportConfig:1 without token and receives Unauthorized + Given database app is created + Given database report-calculation is created + Given document ReportConfig:1 is stored in database app + When the client calls GET /v1/reporting/report-calculation/report/ReportConfig:1 + Then the client receives an json object + Then the client receives status code of 401 + + Scenario: client makes call to GET /reporting/report-calculation/report/ReportConfig:1 and receives empty list + Given database app is created + Given database report-calculation is created + Given document ReportConfig:1 is stored in database app + Given signed in as client dummy-client with secret client-secret in realm dummy-realm + When the client calls GET /v1/reporting/report-calculation/report/ReportConfig:1 + Then the client receives an json array + Then the client receives status code of 200 + Then the client receives array with 0 elements