Commit 2b18e99a authored by Phillip Webb's avatar Phillip Webb

Polish

parent 77d426c2
...@@ -31,7 +31,6 @@ import javax.ws.rs.ext.ContextResolver; ...@@ -31,7 +31,6 @@ import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Provider; import javax.ws.rs.ext.Provider;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.glassfish.jersey.CommonProperties; import org.glassfish.jersey.CommonProperties;
......
...@@ -49,8 +49,9 @@ import org.springframework.web.client.RestTemplate; ...@@ -49,8 +49,9 @@ import org.springframework.web.client.RestTemplate;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Tests for {@link JerseyAutoConfiguration} when using custom ObjectMapper.
*
* @author Eddú Meléndez * @author Eddú Meléndez
*/ */
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
...@@ -98,10 +99,6 @@ public class JerseyAutoConfigurationCustomObjectMapperProviderTests { ...@@ -98,10 +99,6 @@ public class JerseyAutoConfigurationCustomObjectMapperProviderTests {
private String body; private String body;
public Message() {
}
public Message(String subject, String body) { public Message(String subject, String body) {
this.subject = subject; this.subject = subject;
this.body = body; this.body = body;
...@@ -122,6 +119,7 @@ public class JerseyAutoConfigurationCustomObjectMapperProviderTests { ...@@ -122,6 +119,7 @@ public class JerseyAutoConfigurationCustomObjectMapperProviderTests {
public void setBody(String body) { public void setBody(String body) {
this.body = body; this.body = body;
} }
} }
@Target(ElementType.TYPE) @Target(ElementType.TYPE)
...@@ -131,6 +129,7 @@ public class JerseyAutoConfigurationCustomObjectMapperProviderTests { ...@@ -131,6 +129,7 @@ public class JerseyAutoConfigurationCustomObjectMapperProviderTests {
JacksonAutoConfiguration.class, ServerPropertiesAutoConfiguration.class, JacksonAutoConfiguration.class, ServerPropertiesAutoConfiguration.class,
JerseyAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) JerseyAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class })
protected @interface MinimalWebConfiguration { protected @interface MinimalWebConfiguration {
} }
} }
...@@ -50,6 +50,8 @@ import org.springframework.web.client.RestTemplate; ...@@ -50,6 +50,8 @@ import org.springframework.web.client.RestTemplate;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Tests for {@link JerseyAutoConfiguration} with a ObjectMapper.
*
* @author Eddú Meléndez * @author Eddú Meléndez
*/ */
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
...@@ -68,7 +70,8 @@ public class JerseyAutoConfigurationObjectMapperProviderTests { ...@@ -68,7 +70,8 @@ public class JerseyAutoConfigurationObjectMapperProviderTests {
ResponseEntity<String> response = this.restTemplate.getForEntity( ResponseEntity<String> response = this.restTemplate.getForEntity(
"http://localhost:" + this.port + "/rest/message", String.class); "http://localhost:" + this.port + "/rest/message", String.class);
assertThat(HttpStatus.OK).isEqualTo(response.getStatusCode()); assertThat(HttpStatus.OK).isEqualTo(response.getStatusCode());
assertThat("{\"subject\":\"Jersey\",\"body\":null}").isEqualTo(response.getBody()); assertThat("{\"subject\":\"Jersey\",\"body\":null}")
.isEqualTo(response.getBody());
} }
@MinimalWebConfiguration @MinimalWebConfiguration
...@@ -121,6 +124,7 @@ public class JerseyAutoConfigurationObjectMapperProviderTests { ...@@ -121,6 +124,7 @@ public class JerseyAutoConfigurationObjectMapperProviderTests {
public void setBody(String body) { public void setBody(String body) {
this.body = body; this.body = body;
} }
} }
@Target(ElementType.TYPE) @Target(ElementType.TYPE)
...@@ -130,6 +134,7 @@ public class JerseyAutoConfigurationObjectMapperProviderTests { ...@@ -130,6 +134,7 @@ public class JerseyAutoConfigurationObjectMapperProviderTests {
JacksonAutoConfiguration.class, ServerPropertiesAutoConfiguration.class, JacksonAutoConfiguration.class, ServerPropertiesAutoConfiguration.class,
JerseyAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) JerseyAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class })
protected @interface MinimalWebConfiguration { protected @interface MinimalWebConfiguration {
} }
} }
...@@ -22,7 +22,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -22,7 +22,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner; import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
@SpringBootApplication @SpringBootApplication
public class SampleSimpleApplication implements CommandLineRunner { public class SampleSimpleApplication implements CommandLineRunner {
...@@ -43,9 +42,6 @@ public class SampleSimpleApplication implements CommandLineRunner { ...@@ -43,9 +42,6 @@ public class SampleSimpleApplication implements CommandLineRunner {
} }
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
SpringApplication application = new SpringApplication(
SampleSimpleApplication.class);
application.setApplicationContextClass(AnnotationConfigApplicationContext.class);
SpringApplication.run(SampleSimpleApplication.class, args); SpringApplication.run(SampleSimpleApplication.class, args);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment