From cc25b95e9bae9adfce277a5ed54950f33a2bced6 Mon Sep 17 00:00:00 2001 From: Steffen Nitschke Date: Wed, 3 Feb 2021 22:39:21 +0100 Subject: [PATCH] add findGameByIdTest to ServerAppTest --- .../src/test/java/de/fd/fh/ServerAppTest.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/fh.fd.ci.server/src/test/java/de/fd/fh/ServerAppTest.java b/fh.fd.ci.server/src/test/java/de/fd/fh/ServerAppTest.java index 125d6d9..1a9934d 100644 --- a/fh.fd.ci.server/src/test/java/de/fd/fh/ServerAppTest.java +++ b/fh.fd.ci.server/src/test/java/de/fd/fh/ServerAppTest.java @@ -179,5 +179,22 @@ class ServerAppTest assertNotNull(res); assertEquals(200, res.getStatus()); then(gameController).should().createGame(any(), any()); + then(gameController).shouldHaveNoMoreInteractions(); + } + + @Test + void testFindGameById() throws JsonProcessingException + { + when(gameController.findGameById(any(), any())).thenReturn(mock(Response.class)); + + final String url = "/games/12345"; + + ApiTestUtils.TestResponse res = new ApiTestUtils() + .request("GET", url, null, null, String.class); + + assertNotNull(res); + assertEquals(200, res.getStatus()); + then(gameController).should().findGameById(any(), any()); + then(gameController).shouldHaveNoMoreInteractions(); } } \ No newline at end of file