Use autoboxing instead of explicit wrapping in tests
Closes gh-24801
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -107,7 +107,7 @@ public class MessageHeadersTests {
|
||||
|
||||
@Test
|
||||
public void testNonTypedAccessOfHeaderValue() {
|
||||
Integer value = new Integer(123);
|
||||
Integer value = 123;
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("test", value);
|
||||
MessageHeaders headers = new MessageHeaders(map);
|
||||
@@ -116,7 +116,7 @@ public class MessageHeadersTests {
|
||||
|
||||
@Test
|
||||
public void testTypedAccessOfHeaderValue() {
|
||||
Integer value = new Integer(123);
|
||||
Integer value = 123;
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("test", value);
|
||||
MessageHeaders headers = new MessageHeaders(map);
|
||||
@@ -125,7 +125,7 @@ public class MessageHeadersTests {
|
||||
|
||||
@Test
|
||||
public void testHeaderValueAccessWithIncorrectType() {
|
||||
Integer value = new Integer(123);
|
||||
Integer value = 123;
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("test", value);
|
||||
MessageHeaders headers = new MessageHeaders(map);
|
||||
@@ -151,7 +151,7 @@ public class MessageHeadersTests {
|
||||
public void testHeaderKeys() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("key1", "val1");
|
||||
map.put("key2", new Integer(123));
|
||||
map.put("key2", 123);
|
||||
MessageHeaders headers = new MessageHeaders(map);
|
||||
Set<String> keys = headers.keySet();
|
||||
assertThat(keys.contains("key1")).isTrue();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -76,7 +76,7 @@ public class DefaultContentTypeResolverTests {
|
||||
@Test
|
||||
public void resolveUnknownHeaderType() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put(MessageHeaders.CONTENT_TYPE, new Integer(1));
|
||||
map.put(MessageHeaders.CONTENT_TYPE, 1);
|
||||
MessageHeaders headers = new MessageHeaders(map);
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
this.resolver.resolve(headers));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -100,7 +100,7 @@ public class MessageMethodArgumentResolverTests {
|
||||
|
||||
assertThat(actual).isNotNull();
|
||||
assertThat(actual.getHeaders()).isSameAs(message.getHeaders());
|
||||
assertThat(actual.getPayload()).isEqualTo(new Integer(4));
|
||||
assertThat(actual.getPayload()).isEqualTo(4);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,7 +51,7 @@ public class MessageBuilderTests {
|
||||
.setHeader("count", 123)
|
||||
.build();
|
||||
assertThat(message.getHeaders().get("foo", String.class)).isEqualTo("bar");
|
||||
assertThat(message.getHeaders().get("count", Integer.class)).isEqualTo(new Integer(123));
|
||||
assertThat(message.getHeaders().get("count", Integer.class)).isEqualTo(123);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user