|
|
@ -3,6 +3,7 @@ package de.fd.fh; |
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException; |
|
|
|
import de.fd.fh.server.ApiTestUtils; |
|
|
|
import de.fd.fh.server.access.web.AccessController; |
|
|
|
import de.fd.fh.server.game.web.GameController; |
|
|
|
import de.fd.fh.server.user.web.UserController; |
|
|
|
import de.fd.fh.shared.Utils; |
|
|
|
import org.junit.jupiter.api.AfterAll; |
|
|
@ -26,11 +27,12 @@ class ServerAppTest |
|
|
|
{ |
|
|
|
private static UserController userController = mock(UserController.class); |
|
|
|
private static AccessController accessController = mock(AccessController.class); |
|
|
|
private static GameController gameController = mock(GameController.class); |
|
|
|
|
|
|
|
@BeforeAll |
|
|
|
static void before() |
|
|
|
{ |
|
|
|
ServerApp.initController(accessController, userController); |
|
|
|
ServerApp.initController(accessController, userController, gameController); |
|
|
|
ServerApp.main(null); |
|
|
|
|
|
|
|
awaitInitialization(); |
|
|
@ -163,4 +165,19 @@ class ServerAppTest |
|
|
|
assertEquals(200, res.getStatus()); |
|
|
|
then(userController).should().getUser(any(), any()); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
void testCreateGame() throws IOException |
|
|
|
{ |
|
|
|
when(gameController.createGame(any(), any())).thenReturn(mock(Response.class)); |
|
|
|
|
|
|
|
final String url = "/games"; |
|
|
|
|
|
|
|
ApiTestUtils.TestResponse<String> res = new ApiTestUtils<String>() |
|
|
|
.request("POST", url, null, null, String.class); |
|
|
|
|
|
|
|
assertNotNull(res); |
|
|
|
assertEquals(200, res.getStatus()); |
|
|
|
then(gameController).should().createGame(any(), any()); |
|
|
|
} |
|
|
|
} |