From 8f460b2f4116fdedc92759fd5f07e755db9fd092 Mon Sep 17 00:00:00 2001 From: Steffen Nitschke Date: Wed, 3 Feb 2021 22:43:42 +0100 Subject: [PATCH] add findRunningGamesOfUser to ServerAppTest --- .../src/test/java/de/fd/fh/ServerAppTest.java | 16 ++++++++++++++++ 1 file changed, 16 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 1a9934d..0422115 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 @@ -197,4 +197,20 @@ class ServerAppTest then(gameController).should().findGameById(any(), any()); then(gameController).shouldHaveNoMoreInteractions(); } + + @Test + void testFindRunningGamesOfUser() throws JsonProcessingException + { + when(gameController.findRunningGamesOfUser(any(), any())).thenReturn(mock(Response.class)); + + final String url = "/games/findByUser/12345"; + + ApiTestUtils.TestResponse res = new ApiTestUtils() + .request("GET", url, null, null, String.class); + + assertNotNull(res); + assertEquals(200, res.getStatus()); + then(gameController).should().findRunningGamesOfUser(any(), any()); + then(gameController).shouldHaveNoMoreInteractions(); + } } \ No newline at end of file