|
@ -8,11 +8,15 @@ import org.junit.jupiter.api.AfterAll; |
|
|
import org.junit.jupiter.api.BeforeAll; |
|
|
import org.junit.jupiter.api.BeforeAll; |
|
|
import org.junit.jupiter.api.Test; |
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
import java.util.HashMap; |
|
|
import java.util.HashMap; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
|
|
|
import static org.mockito.ArgumentMatchers.any; |
|
|
|
|
|
import static org.mockito.BDDMockito.then; |
|
|
import static org.mockito.Mockito.mock; |
|
|
import static org.mockito.Mockito.mock; |
|
|
|
|
|
import static org.mockito.Mockito.when; |
|
|
import static spark.Spark.awaitInitialization; |
|
|
import static spark.Spark.awaitInitialization; |
|
|
import static spark.Spark.stop; |
|
|
import static spark.Spark.stop; |
|
|
|
|
|
|
|
@ -50,4 +54,19 @@ class ServerAppTest |
|
|
assertEquals(200, res.getStatus()); |
|
|
assertEquals(200, res.getStatus()); |
|
|
assertEquals("Hello World", res.getBody()); |
|
|
assertEquals("Hello World", res.getBody()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void testRegistrate() throws IOException |
|
|
|
|
|
{ |
|
|
|
|
|
when(accessController.registrate(any(), any())).thenReturn("Test"); |
|
|
|
|
|
|
|
|
|
|
|
String url = "/accounts/registrate"; |
|
|
|
|
|
|
|
|
|
|
|
ApiTestUtils.TestResponse<String> res = new ApiTestUtils<String>() |
|
|
|
|
|
.request("POST", url, null, null, String.class); |
|
|
|
|
|
|
|
|
|
|
|
assertNotNull(res); |
|
|
|
|
|
assertEquals(200, res.getStatus()); |
|
|
|
|
|
then(accessController).should().registrate(any(), any()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |