Skip to content

Commit f46d799

Browse files
committed
Polish
1 parent 3fe0b84 commit f46d799

File tree

8 files changed

+37
-24
lines changed

8 files changed

+37
-24
lines changed

spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthMvcEndpointAutoConfigurationTests.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ public void testSetRoles() throws Exception {
108108
public void endpointConditionalOnMissingBean() throws Exception {
109109
this.context = new AnnotationConfigWebApplicationContext();
110110
this.context.setServletContext(new MockServletContext());
111-
this.context.register(TestConfiguration.class, TestHealthMvcEndpointConfiguration.class);
111+
this.context.register(TestConfiguration.class,
112+
TestHealthMvcEndpointConfiguration.class);
112113
this.context.refresh();
113114
MockHttpServletRequest request = new MockHttpServletRequest();
114115
Health health = (Health) this.context.getBean(HealthMvcEndpoint.class)
@@ -142,6 +143,7 @@ static class TestHealthMvcEndpointConfiguration {
142143
public HealthMvcEndpoint endpoint(HealthEndpoint endpoint) {
143144
return new TestHealthMvcEndpoint(endpoint);
144145
}
146+
145147
}
146148

147149
static class TestHealthMvcEndpoint extends HealthMvcEndpoint {
@@ -151,9 +153,11 @@ static class TestHealthMvcEndpoint extends HealthMvcEndpoint {
151153
}
152154

153155
@Override
154-
protected boolean exposeHealthDetails(HttpServletRequest request, Principal principal) {
156+
protected boolean exposeHealthDetails(HttpServletRequest request,
157+
Principal principal) {
155158
return true;
156159
}
160+
157161
}
158162

159163
static class TestHealthIndicator extends AbstractHealthIndicator {

spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/ExampleJsonObjectWithView.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,3 @@ static class TestView {
7373
}
7474

7575
}
76-

spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/JsonTestIntegrationTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
* Integration tests for {@link JsonTest}.
3333
*
3434
* @author Phillip Webb
35+
* @author Madhura Bhave
3536
*/
3637
@RunWith(SpringRunner.class)
3738
@JsonTest
@@ -82,9 +83,9 @@ public void customView() throws Exception {
8283
ExampleJsonObjectWithView object = new ExampleJsonObjectWithView();
8384
object.setValue("spring");
8485
JsonContent<ExampleJsonObjectWithView> content = this.jacksonWithViewJson
85-
.forView(ExampleJsonObjectWithView.TestView.class)
86-
.write(object);
86+
.forView(ExampleJsonObjectWithView.TestView.class).write(object);
8787
assertThat(content).doesNotHaveJsonPathValue("id");
8888
assertThat(content).isEqualToJson("example.json");
8989
}
90+
9091
}

spring-boot-test/src/main/java/org/springframework/boot/test/json/AbstractJsonMarshalTester.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ protected final ResolvableType getType() {
113113
return this.type;
114114
}
115115

116+
/**
117+
* Return class used to load relative resources.
118+
* @return the resource load class
119+
*/
116120
protected final Class<?> getResourceLoadClass() {
117121
return this.resourceLoadClass;
118122
}

spring-boot-test/src/main/java/org/springframework/boot/test/json/JacksonTester.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,14 @@ public static void initFields(Object testInstance,
152152
}
153153

154154
/**
155-
* Returns a new instance of {@link JacksonTester} with the view
156-
* that should be used for json serialization/deserialization.
155+
* Returns a new instance of {@link JacksonTester} with the view that should be used
156+
* for json serialization/deserialization.
157157
* @param view the view class
158158
* @return the new instance
159159
*/
160160
public JacksonTester<T> forView(Class<?> view) {
161-
return new JacksonTester<T>(this.getResourceLoadClass(), this.getType(), this.objectMapper, view);
161+
return new JacksonTester<T>(this.getResourceLoadClass(), this.getType(),
162+
this.objectMapper, view);
162163
}
163164

164165
/**

spring-boot-test/src/test/java/org/springframework/boot/test/json/ExampleObject.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,3 @@ public String toString() {
6464
}
6565

6666
}
67-

spring-boot-test/src/test/java/org/springframework/boot/test/json/JacksonTesterIntegrationTests.java

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
* Integration tests for {@link JacksonTester}. Shows typical usage.
3636
*
3737
* @author Phillip Webb
38+
* @author Madhura Bhave
3839
*/
3940
public class JacksonTesterIntegrationTests {
4041

@@ -56,6 +57,13 @@ public void setup() {
5657
JacksonTester.initFields(this, this.objectMapper);
5758
}
5859

60+
@Test
61+
public void typicalTest() throws Exception {
62+
String example = JSON;
63+
assertThat(this.simpleJson.parse(example).getObject().getName())
64+
.isEqualTo("Spring");
65+
}
66+
5967
@Test
6068
public void typicalListTest() throws Exception {
6169
String example = "[" + JSON + "]";
@@ -79,32 +87,29 @@ public void writeWithView() throws Exception {
7987
ExampleObjectWithView object = new ExampleObjectWithView();
8088
object.setName("Spring");
8189
object.setAge(123);
82-
JsonContent<ExampleObjectWithView> content = this.jsonWithView.forView(
83-
ExampleObjectWithView.TestView.class).write(object);
84-
assertThat(content).extractingJsonPathStringValue("@.name")
85-
.isEqualTo("Spring");
90+
JsonContent<ExampleObjectWithView> content = this.jsonWithView
91+
.forView(ExampleObjectWithView.TestView.class).write(object);
92+
assertThat(content).extractingJsonPathStringValue("@.name").isEqualTo("Spring");
8693
assertThat(content).doesNotHaveJsonPathValue("age");
8794
}
8895

8996
@Test
9097
public void readWithResourceAndView() throws Exception {
9198
this.objectMapper.disable(MapperFeature.DEFAULT_VIEW_INCLUSION);
9299
ByteArrayResource resource = new ByteArrayResource(JSON.getBytes());
93-
ObjectContent<ExampleObjectWithView> content = this.jsonWithView.forView(
94-
ExampleObjectWithView.TestView.class).read(resource);
95-
assertThat(content.getObject().getName())
96-
.isEqualTo("Spring");
100+
ObjectContent<ExampleObjectWithView> content = this.jsonWithView
101+
.forView(ExampleObjectWithView.TestView.class).read(resource);
102+
assertThat(content.getObject().getName()).isEqualTo("Spring");
97103
assertThat(content.getObject().getAge()).isEqualTo(0);
98104
}
99105

100106
@Test
101107
public void readWithReaderAndView() throws Exception {
102108
this.objectMapper.disable(MapperFeature.DEFAULT_VIEW_INCLUSION);
103109
Reader reader = new StringReader(JSON);
104-
ObjectContent<ExampleObjectWithView> content = this.jsonWithView.forView(
105-
ExampleObjectWithView.TestView.class).read(reader);
106-
assertThat(content.getObject().getName())
107-
.isEqualTo("Spring");
110+
ObjectContent<ExampleObjectWithView> content = this.jsonWithView
111+
.forView(ExampleObjectWithView.TestView.class).read(reader);
112+
assertThat(content.getObject().getName()).isEqualTo("Spring");
108113
assertThat(content.getObject().getAge()).isEqualTo(0);
109114
}
110115

spring-boot/src/main/java/org/springframework/boot/admin/SpringApplicationAdminMXBean.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ public interface SpringApplicationAdminMXBean {
3333
boolean isReady();
3434

3535
/**
36-
* Specify if the application runs in an embedded web container. Return
37-
* {@code false} on a web application that hasn't fully started yet, so it is
38-
* preferable to wait for the application to be {@link #isReady() ready}.
36+
* Specify if the application runs in an embedded web container. Return {@code false}
37+
* on a web application that hasn't fully started yet, so it is preferable to wait for
38+
* the application to be {@link #isReady() ready}.
3939
* @return {@code true} if the application runs in an embedded web container
4040
* @see #isReady()
4141
*/

0 commit comments

Comments
 (0)