Use autoboxing instead of explicit wrapping in tests

Closes gh-24801
This commit is contained in:
陈其苗
2020-03-27 23:39:52 +08:00
committed by Sam Brannen
parent d8567749b8
commit 13970ae528
45 changed files with 308 additions and 308 deletions

View File

@@ -287,7 +287,7 @@ public class Jackson2ObjectMapperBuilderTests {
.build();
DateTime dateTime = new DateTime(1322903730000L, DateTimeZone.UTC);
assertThat(new String(objectMapper.writeValueAsBytes(dateTime), "UTF-8")).isEqualTo("1322903730000");
assertThat(new String(objectMapper.writeValueAsBytes(new Integer(4)), "UTF-8")).contains("customid");
assertThat(new String(objectMapper.writeValueAsBytes(4), "UTF-8")).contains("customid");
}
@Test // SPR-12634
@@ -300,7 +300,7 @@ public class Jackson2ObjectMapperBuilderTests {
.build();
DateTime dateTime = new DateTime(1322903730000L, DateTimeZone.UTC);
assertThat(new String(objectMapper.writeValueAsBytes(dateTime), "UTF-8")).isEqualTo("1322903730000");
assertThat(new String(objectMapper.writeValueAsBytes(new Integer(4)), "UTF-8")).contains("customid");
assertThat(new String(objectMapper.writeValueAsBytes(4), "UTF-8")).contains("customid");
}
@Test // SPR-12634
@@ -311,7 +311,7 @@ public class Jackson2ObjectMapperBuilderTests {
.serializerByType(Integer.class, new CustomIntegerSerializer()).build();
DateTime dateTime = new DateTime(1322903730000L, DateTimeZone.UTC);
assertThat(new String(objectMapper.writeValueAsBytes(dateTime), "UTF-8")).isEqualTo("1322903730000");
assertThat(new String(objectMapper.writeValueAsBytes(new Integer(4)), "UTF-8")).contains("customid");
assertThat(new String(objectMapper.writeValueAsBytes(4), "UTF-8")).contains("customid");
}
@Test // gh-22576

View File

@@ -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.
@@ -221,7 +221,7 @@ public class Jackson2ObjectMapperFactoryBeanTests {
DateTime dateTime = new DateTime(1322903730000L, DateTimeZone.UTC);
assertThat(new String(objectMapper.writeValueAsBytes(dateTime), "UTF-8")).isEqualTo("1322903730000");
assertThat(new String(objectMapper.writeValueAsBytes(new Integer(4)), "UTF-8")).contains("customid");
assertThat(new String(objectMapper.writeValueAsBytes(4), "UTF-8")).contains("customid");
}
@Test // SPR-12634
@@ -235,7 +235,7 @@ public class Jackson2ObjectMapperFactoryBeanTests {
DateTime dateTime = new DateTime(1322903730000L, DateTimeZone.UTC);
assertThat(new String(objectMapper.writeValueAsBytes(dateTime), "UTF-8")).isEqualTo("1322903730000");
assertThat(new String(objectMapper.writeValueAsBytes(new Integer(4)), "UTF-8")).contains("customid");
assertThat(new String(objectMapper.writeValueAsBytes(4), "UTF-8")).contains("customid");
}
@Test

View File

@@ -42,7 +42,7 @@ class ServletRequestUtilsTests {
request.addParameter("param2", "e");
request.addParameter("paramEmpty", "");
assertThat(ServletRequestUtils.getIntParameter(request, "param1")).isEqualTo(new Integer(5));
assertThat(ServletRequestUtils.getIntParameter(request, "param1")).isEqualTo(5);
assertThat(ServletRequestUtils.getIntParameter(request, "param1", 6)).isEqualTo(5);
assertThat(ServletRequestUtils.getRequiredIntParameter(request, "param1")).isEqualTo(5);

View File

@@ -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.
@@ -163,12 +163,12 @@ public class ServletRequestAttributesTests {
@Test
public void skipImmutableInteger() {
doSkipImmutableValue(new Integer(1));
doSkipImmutableValue(1);
}
@Test
public void skipImmutableFloat() {
doSkipImmutableValue(new Float(1.1));
doSkipImmutableValue(1.1F);
}
@Test

View File

@@ -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.
@@ -98,7 +98,7 @@ public class HtmlCharacterEntityReferencesTests {
while (entityIterator.hasNext()) {
int character = entityIterator.getReferredCharacter();
String entityName = entityIterator.nextEntry();
referencedCharactersMap.put(new Integer(character), entityName);
referencedCharactersMap.put(character, entityName);
}
return referencedCharactersMap;
}