java-tutorials/spring-mustache/src/test/java/com/baeldung/springmustache/SpringMustacheApplicationIntegrationTest.java
Dhawal Kapil 9d8b90794e BAEL-8962 Fix surefire configs of twitterhdfs, spring cloud projects
- Surefire config fixes
- pom fixes and standardization
- test names standardization
- added packaging pom at spring-cloud-bus and spring-cloud/spring-cloud-task level
2018-09-25 23:22:58 +05:30

31 lines
1.0 KiB
Java

package com.baeldung.springmustache;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
public class SpringMustacheApplicationIntegrationTest {
@Autowired
private TestRestTemplate restTemplate;
@Test
public void givenIndexPageWhenContainsArticleThenTrue() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/article", String.class);
Assert.assertTrue(entity.getStatusCode().equals(HttpStatus.OK));
Assert.assertTrue(entity.getBody().contains("Article Title 0"));
}
}