* Implementation of Introduction to Play Framework in Java * Implementation of Introduction to Play Framework in Java * Implementation of Introduction to Play Framework in Java * Implementation of the tutorial for Introduction to Play Framework. * Updated code for Play Routing to 2.7.3 * Updated code for Play Routing to 2.7.3 * Initial Commit * Added request object to create end point * Finished implementing student-api * Finished implementing student-api * Implementation of the tutorial for Introduction to Play Framework. * Updated test names * Removed Lombok dependency * Corrected isSuccessful spelling and removed the +1 on student ids
37 lines
980 B
Java
37 lines
980 B
Java
package controllers;
|
|
|
|
import org.junit.Test;
|
|
import play.Application;
|
|
import play.inject.guice.GuiceApplicationBuilder;
|
|
import play.mvc.Http;
|
|
import play.mvc.Result;
|
|
import play.test.WithApplication;
|
|
import play.twirl.api.Html;
|
|
|
|
import java.util.Optional;
|
|
import java.util.concurrent.CompletionStage;
|
|
|
|
import static org.junit.Assert.assertEquals;
|
|
import static org.junit.Assert.assertTrue;
|
|
import static play.mvc.Http.Status.*;
|
|
import static play.test.Helpers.GET;
|
|
import static play.test.Helpers.route;
|
|
|
|
public class HomeControllerUnitTest extends WithApplication {
|
|
|
|
@Override
|
|
protected Application provideApplication() {
|
|
return new GuiceApplicationBuilder().build();
|
|
}
|
|
|
|
@Test
|
|
public void givenRequest_whenRootPath_ThenStatusOkay() {
|
|
Http.RequestBuilder request = new Http.RequestBuilder()
|
|
.method(GET)
|
|
.uri("/");
|
|
|
|
Result result = route(app, request);
|
|
assertEquals(OK, result.status());
|
|
}
|
|
}
|