Use Integer.parseInt instead of Integer.valueOf for primitive int
Closes gh-25456
This commit is contained in:
@@ -416,11 +416,11 @@ public abstract class AbstractCacheAnnotationTests {
|
||||
Integer three = 3;
|
||||
|
||||
Cache cache = this.cm.getCache("testCache");
|
||||
assertThat((int) Integer.valueOf(service.conditionalUpdate(one).toString())).isEqualTo((int) one);
|
||||
assertThat(Integer.parseInt(service.conditionalUpdate(one).toString())).isEqualTo((int) one);
|
||||
assertThat(cache.get(one)).isNull();
|
||||
|
||||
assertThat((int) Integer.valueOf(service.conditionalUpdate(three).toString())).isEqualTo((int) three);
|
||||
assertThat((int) Integer.valueOf(cache.get(three).get().toString())).isEqualTo((int) three);
|
||||
assertThat(Integer.parseInt(service.conditionalUpdate(three).toString())).isEqualTo((int) three);
|
||||
assertThat(Integer.parseInt(cache.get(three).get().toString())).isEqualTo((int) three);
|
||||
}
|
||||
|
||||
protected void testMultiCache(CacheableService<?> service) {
|
||||
|
||||
@@ -195,7 +195,7 @@ public class EnableCachingIntegrationTests {
|
||||
|
||||
@Bean
|
||||
public Bar bar() {
|
||||
return new Bar(Boolean.valueOf(env.getProperty("bar.enabled")));
|
||||
return new Bar(Boolean.parseBoolean(env.getProperty("bar.enabled")));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -411,11 +411,11 @@ public abstract class AbstractCacheAnnotationTests {
|
||||
Integer three = 3;
|
||||
|
||||
Cache cache = this.cm.getCache("testCache");
|
||||
assertThat((int) Integer.valueOf(service.conditionalUpdate(one).toString())).isEqualTo((int) one);
|
||||
assertThat(Integer.parseInt(service.conditionalUpdate(one).toString())).isEqualTo((int) one);
|
||||
assertThat(cache.get(one)).isNull();
|
||||
|
||||
assertThat((int) Integer.valueOf(service.conditionalUpdate(three).toString())).isEqualTo((int) three);
|
||||
assertThat((int) Integer.valueOf(cache.get(three).get().toString())).isEqualTo((int) three);
|
||||
assertThat(Integer.parseInt(service.conditionalUpdate(three).toString())).isEqualTo((int) three);
|
||||
assertThat(Integer.parseInt(cache.get(three).get().toString())).isEqualTo((int) three);
|
||||
}
|
||||
|
||||
protected void testMultiCache(CacheableService<?> service) {
|
||||
|
||||
@@ -55,7 +55,7 @@ class TransformerUtilsTests {
|
||||
void enableIndentingSunnyDayWithCustomKosherIndentAmount() throws Exception {
|
||||
final String indentAmountProperty = "10";
|
||||
Transformer transformer = new StubTransformer();
|
||||
TransformerUtils.enableIndenting(transformer, Integer.valueOf(indentAmountProperty));
|
||||
TransformerUtils.enableIndenting(transformer, Integer.parseInt(indentAmountProperty));
|
||||
String indent = transformer.getOutputProperty(OutputKeys.INDENT);
|
||||
assertThat(indent).isNotNull();
|
||||
assertThat(indent).isEqualTo("yes");
|
||||
|
||||
@@ -34,7 +34,7 @@ public class SockJsUrlInfoTests {
|
||||
@Test
|
||||
public void serverId() throws Exception {
|
||||
SockJsUrlInfo info = new SockJsUrlInfo(new URI("https://example.com"));
|
||||
int serverId = Integer.valueOf(info.getServerId());
|
||||
int serverId = Integer.parseInt(info.getServerId());
|
||||
assertThat(serverId >= 0 && serverId < 1000).as("Invalid serverId: " + serverId).isTrue();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user