2013-12-31 16:40:21 +08:00
|
|
|
package sample.jsp;
|
2013-08-24 06:23:45 +08:00
|
|
|
|
2014-03-11 21:54:30 +08:00
|
|
|
import static org.junit.Assert.assertEquals;
|
|
|
|
import static org.junit.Assert.assertTrue;
|
2013-08-24 06:23:45 +08:00
|
|
|
|
|
|
|
import org.junit.Test;
|
2014-03-11 21:54:30 +08:00
|
|
|
import org.junit.runner.RunWith;
|
|
|
|
import org.springframework.boot.test.IntegrationTest;
|
|
|
|
import org.springframework.boot.test.RestTemplates;
|
|
|
|
import org.springframework.boot.test.SpringApplicationConfiguration;
|
2013-08-24 06:23:45 +08:00
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
import org.springframework.http.ResponseEntity;
|
2014-03-11 21:54:30 +08:00
|
|
|
import org.springframework.test.annotation.DirtiesContext;
|
|
|
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|
|
|
import org.springframework.test.context.web.WebAppConfiguration;
|
2013-08-24 06:23:45 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Basic integration tests for JSP application.
|
2013-11-16 15:42:40 +08:00
|
|
|
*
|
2013-08-24 06:23:45 +08:00
|
|
|
* @author Phillip Webb
|
|
|
|
*/
|
2014-03-11 21:54:30 +08:00
|
|
|
@RunWith(SpringJUnit4ClassRunner.class)
|
|
|
|
@SpringApplicationConfiguration(classes=SampleWebJspApplication.class)
|
|
|
|
@WebAppConfiguration
|
|
|
|
@IntegrationTest
|
|
|
|
@DirtiesContext
|
2013-08-24 06:23:45 +08:00
|
|
|
public class SampleWebJspApplicationTests {
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testJspWithEl() throws Exception {
|
2014-03-11 21:54:30 +08:00
|
|
|
ResponseEntity<String> entity = RestTemplates.get().getForEntity(
|
2013-08-24 06:23:45 +08:00
|
|
|
"http://localhost:8080", String.class);
|
|
|
|
assertEquals(HttpStatus.OK, entity.getStatusCode());
|
2013-11-16 15:42:40 +08:00
|
|
|
assertTrue("Wrong body:\n" + entity.getBody(),
|
|
|
|
entity.getBody().contains("/resources/text.txt"));
|
2013-08-24 06:23:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|