Polish
This commit is contained in:
parent
77d426c284
commit
2b18e99ac7
|
@ -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;
|
||||||
|
|
||||||
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 {
|
||||||
|
|
||||||
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 {
|
||||||
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 {
|
||||||
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;
|
||||||
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 {
|
||||||
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 {
|
||||||
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 {
|
||||||
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;
|
||||||
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 {
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue