From 07cfaecbd90bd698f5374a12c6892fadb3f1d8a8 Mon Sep 17 00:00:00 2001 From: eugenp Date: Fri, 30 Dec 2016 00:46:38 +0200 Subject: [PATCH] minor cleanup --- .../CustomMediaTypeControllerLiveTest.java | 21 +++++++++++-------- .../web/controller/mediatypes/TestConfig.java | 1 - 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/spring-rest/src/test/java/org/baeldung/web/controller/mediatypes/CustomMediaTypeControllerLiveTest.java b/spring-rest/src/test/java/org/baeldung/web/controller/mediatypes/CustomMediaTypeControllerLiveTest.java index befb851a2c..8eb2a96593 100644 --- a/spring-rest/src/test/java/org/baeldung/web/controller/mediatypes/CustomMediaTypeControllerLiveTest.java +++ b/spring-rest/src/test/java/org/baeldung/web/controller/mediatypes/CustomMediaTypeControllerLiveTest.java @@ -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)); diff --git a/spring-rest/src/test/java/org/baeldung/web/controller/mediatypes/TestConfig.java b/spring-rest/src/test/java/org/baeldung/web/controller/mediatypes/TestConfig.java index 66ffe4947d..340e0284af 100644 --- a/spring-rest/src/test/java/org/baeldung/web/controller/mediatypes/TestConfig.java +++ b/spring-rest/src/test/java/org/baeldung/web/controller/mediatypes/TestConfig.java @@ -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 {