Rely on automatic boxing/unboxing in tests
Closes gh-29414
This commit is contained in:
committed by
Sam Brannen
parent
7d68d0625c
commit
b2c8546013
@@ -92,7 +92,7 @@ public class ObjectToStringHttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
public void defaultCharset() throws IOException {
|
||||
this.converter.write(Integer.valueOf(5), null, response);
|
||||
this.converter.write(5, null, response);
|
||||
|
||||
assertThat(servletResponse.getCharacterEncoding()).isEqualTo("ISO-8859-1");
|
||||
}
|
||||
@@ -124,20 +124,20 @@ public class ObjectToStringHttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
public void read() throws IOException {
|
||||
Short shortValue = Short.valueOf((short) 781);
|
||||
Short shortValue = (short) 781;
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
request.setContentType(MediaType.TEXT_PLAIN_VALUE);
|
||||
request.setContent(shortValue.toString().getBytes(StringHttpMessageConverter.DEFAULT_CHARSET));
|
||||
assertThat(this.converter.read(Short.class, new ServletServerHttpRequest(request))).isEqualTo(shortValue);
|
||||
|
||||
Float floatValue = Float.valueOf(123);
|
||||
Float floatValue = 123F;
|
||||
request = new MockHttpServletRequest();
|
||||
request.setContentType(MediaType.TEXT_PLAIN_VALUE);
|
||||
request.setCharacterEncoding("UTF-16");
|
||||
request.setContent(floatValue.toString().getBytes("UTF-16"));
|
||||
assertThat(this.converter.read(Float.class, new ServletServerHttpRequest(request))).isEqualTo(floatValue);
|
||||
|
||||
Long longValue = Long.valueOf(55819182821331L);
|
||||
Long longValue = 55819182821331L;
|
||||
request = new MockHttpServletRequest();
|
||||
request.setContentType(MediaType.TEXT_PLAIN_VALUE);
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
@@ -158,7 +158,7 @@ public class ObjectToStringHttpMessageConverterTests {
|
||||
@Test
|
||||
public void writeUtf16() throws IOException {
|
||||
MediaType contentType = new MediaType("text", "plain", StandardCharsets.UTF_16);
|
||||
this.converter.write(Integer.valueOf(958), contentType, this.response);
|
||||
this.converter.write(958, contentType, this.response);
|
||||
|
||||
assertThat(this.servletResponse.getCharacterEncoding()).isEqualTo("UTF-16");
|
||||
assertThat(this.servletResponse.getContentType().startsWith(MediaType.TEXT_PLAIN_VALUE)).isTrue();
|
||||
|
||||
@@ -152,7 +152,7 @@ public class ServletRequestAttributesTests {
|
||||
|
||||
@Test
|
||||
public void skipImmutableCharacter() {
|
||||
doSkipImmutableValue(Character.valueOf('x'));
|
||||
doSkipImmutableValue('x');
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user