diff --git a/integration-tests/src/test/java/integration/streams/StreamsTest.java b/integration-tests/src/test/java/integration/streams/StreamsTest.java index cc3a2f801bd8..63b7e4752d11 100644 --- a/integration-tests/src/test/java/integration/streams/StreamsTest.java +++ b/integration-tests/src/test/java/integration/streams/StreamsTest.java @@ -110,7 +110,7 @@ public void createStreamWithTitleAndDescription() throws Exception { } @Test - public void incompleteStream() throws Exception { + public void creatingIncompleteStreamShouldFail() throws Exception { final int beforeCount = streamCount(); final ValidatableResponse response = createStreamFromRequest(jsonResourceForMethod()); @@ -121,7 +121,8 @@ public void incompleteStream() throws Exception { } @Test - public void invalidStream() throws Exception { + @MongoDbSeed + public void creatingInvalidStreamShouldFail() throws Exception { final int beforeCount = streamCount(); final ValidatableResponse response = createStreamFromRequest("{}"); @@ -131,6 +132,42 @@ public void invalidStream() throws Exception { assertThat(afterCount).isEqualTo(beforeCount); } + @Test + @MongoDbSeed(locations = {"single-stream"}) + public void deletingSingleStream() { + final String streamId = "552b92b2e4b0c055e41ffb8e"; + assertThat(streamCount()).isEqualTo(1); + + given() + .when() + .delete("/streams/"+streamId) + .then() + .statusCode(204); + + assertThat(streamCount()).isEqualTo(0); + + given() + .when() + .get("/streams/"+streamId) + .then() + .statusCode(404); + } + + @Test + @MongoDbSeed(locations = {"single-stream"}) + public void deletingNonexistentStreamShouldFail() { + final String streamId = "552b92b2e4b0c055e41ffb8f"; + assertThat(streamCount()).isEqualTo(1); + + given() + .when() + .delete("/streams/"+streamId) + .then() + .statusCode(404); + + assertThat(streamCount()).isEqualTo(1); + } + protected ValidatableResponse createStreamFromRequest(byte[] request) { return given() .when() diff --git a/integration-tests/src/test/resources/integration/streams/StreamsTest/delete-single-stream.json b/integration-tests/src/test/resources/integration/streams/StreamsTest/single-stream.json similarity index 100% rename from integration-tests/src/test/resources/integration/streams/StreamsTest/delete-single-stream.json rename to integration-tests/src/test/resources/integration/streams/StreamsTest/single-stream.json diff --git a/integration-tests/src/test/resources/integration/streams/incomplete-stream.json b/integration-tests/src/test/resources/integration/streams/creating-incomplete-stream-should-fail.json similarity index 100% rename from integration-tests/src/test/resources/integration/streams/incomplete-stream.json rename to integration-tests/src/test/resources/integration/streams/creating-incomplete-stream-should-fail.json