BAEL-3464 - Ninja framework
This commit is contained in:
@@ -2,37 +2,26 @@ package controllers;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.doctester.testbrowser.Request;
|
||||
import org.doctester.testbrowser.Response;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mock;
|
||||
|
||||
import ninja.NinjaDocTester;
|
||||
import services.UserService;
|
||||
|
||||
public class ApiControllerDocTesterTest extends NinjaDocTester {
|
||||
|
||||
String URL_INDEX = "/";
|
||||
String URL_HELLO = "/hello";
|
||||
String URL_USER_JSON = "/userJson";
|
||||
String URL_USERS = "/users";
|
||||
|
||||
@Mock
|
||||
UserService userService;
|
||||
|
||||
@Test
|
||||
public void testGetIndex() {
|
||||
Response response = makeRequest(Request.GET().url(testServerUrl().path(URL_INDEX)));
|
||||
assertThat(response.payload, containsString("Bonjour, bienvenue dans Ninja Framework!"));
|
||||
assertThat(response.payload, containsString("Hello, welcome to Ninja Framework!"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetHello() {
|
||||
Response response = makeRequest(Request.GET().url(testServerUrl().path(URL_HELLO)));
|
||||
assertThat(response.payload, containsString("Hello, welcome to Ninja Framework!"));
|
||||
assertThat(response.payload, containsString("Bonjour, bienvenue dans Ninja Framework!"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,19 +1,10 @@
|
||||
package controllers;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.doctester.testbrowser.Request;
|
||||
import org.doctester.testbrowser.Response;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
|
||||
import ninja.NinjaRunner;
|
||||
import ninja.Result;
|
||||
import services.UserService;
|
||||
@@ -35,7 +26,7 @@ public class ApiControllerMockTest {
|
||||
public void testThatGetUserJson() {
|
||||
Result result = applicationController.userJson();
|
||||
System.out.println(result.getRenderable());
|
||||
assertEquals(userService.getUser().toString(), result.getRenderable().toString());
|
||||
assertEquals(userService.getUserMap().toString(), result.getRenderable().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user