<dependency> <groupId>com.googlecode.play-test</groupId> <artifactId>play-test_2.10</artifactId> <version>1.5-RC2</version> <scope>test</scope> </dependency> import static play.test.Helpers.*; import org.junit.Test; import play.mvc.*; import play.test.WithApplication; import static org.junit.Assert.*; public class MyComponentTest extends WithApplication { @Test public void testMyComponent() { Result result = route(fakeRequest(GET, "/mycomponent")); assertEquals(OK, result.status()); assertEquals("text/html", result.contentType().get()); assertTrue(contentAsString(result).contains("Response from MyComponent")); } } $ mvn test


上一篇:
下一篇:
切换中文