minor cleanup

This commit is contained in:
eugenp 2016-12-30 00:46:38 +02:00
parent 0e163811ac
commit 07cfaecbd9
2 changed files with 12 additions and 10 deletions

View File

@ -1,31 +1,34 @@
package org.baeldung.web.controller.mediatypes;
import com.jayway.restassured.RestAssured;
import com.jayway.restassured.response.Response;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.support.AnnotationConfigContextLoader;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import com.jayway.restassured.RestAssured;
import com.jayway.restassured.response.Response;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {TestConfig.class}, loader = AnnotationConfigContextLoader.class)
@ContextConfiguration(classes = { TestConfig.class }, loader = AnnotationConfigContextLoader.class)
public class CustomMediaTypeControllerLiveTest {
private static final String URL_PREFIX = "http://localhost:8082/spring-rest";
private static final String CUSTOM_CONTENT_TYPE = "application/vnd.baeldung.api.v1+json";
//
@Test
public void getFor_customMediaType() {
//given
public void whenGet_receiveCustomMediaType() {
// given
String url = URL_PREFIX + "/public/api/endpoint";
//when
// when
Response response = RestAssured.get(url);
//then
// then
assertEquals(200, response.getStatusCode());
assertTrue(response.contentType().contains(CUSTOM_CONTENT_TYPE));

View File

@ -3,7 +3,6 @@ package org.baeldung.web.controller.mediatypes;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan({ "org.baeldung.web" })
public class TestConfig {