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

@@ -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.
@@ -686,7 +686,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
this.bean.setJedi(true);
this.bean.setSomeBoolean(Boolean.TRUE);
this.bean.setStringArray(new String[] {"bar", "foo"});
this.bean.setSomeIntegerArray(new Integer[] {new Integer(2), new Integer(1)});
this.bean.setSomeIntegerArray(new Integer[] {2, 1});
this.bean.setOtherColours(colours);
this.bean.setPets(pets);
this.bean.setSomeList(someList);

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.
@@ -767,7 +767,7 @@ public class CheckboxesTagTests extends AbstractFormTagTests {
this.bean.setJedi(true);
this.bean.setSomeBoolean(Boolean.TRUE);
this.bean.setStringArray(new String[] {"bar", "foo"});
this.bean.setSomeIntegerArray(new Integer[] {new Integer(2), new Integer(1)});
this.bean.setSomeIntegerArray(new Integer[] {2, 1});
this.bean.setOtherColours(colours);
this.bean.setPets(pets);
this.bean.setSomeSet(someObjects);

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.
@@ -614,7 +614,7 @@ public class RadioButtonsTagTests extends AbstractFormTagTests {
this.bean.setJedi(true);
this.bean.setSomeBoolean(Boolean.TRUE);
this.bean.setStringArray(new String[] {"bar", "foo"});
this.bean.setSomeIntegerArray(new Integer[] {new Integer(2), new Integer(1)});
this.bean.setSomeIntegerArray(new Integer[] {2, 1});
this.bean.setOtherColours(colours);
this.bean.setPets(pets);
List list = new ArrayList();

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.
@@ -392,7 +392,7 @@ public class SelectTagTests extends AbstractFormTagTests {
this.tag.setPath("someIntegerArray");
Integer[] array = new Integer[50];
for (int i = 0; i < array.length; i++) {
array[i] = new Integer(i);
array[i] = i;
}
this.tag.setItems(array);
int result = this.tag.doStartTag();
@@ -1012,7 +1012,7 @@ public class SelectTagTests extends AbstractFormTagTests {
this.bean.setCountry("UK");
this.bean.setSex("M");
this.bean.setMyFloat(new Float("12.34"));
this.bean.setSomeIntegerArray(new Integer[]{new Integer(12), new Integer(34)});
this.bean.setSomeIntegerArray(new Integer[]{12, 34});
return this.bean;
}

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.
@@ -227,7 +227,7 @@ public class ViewResolverTests {
props.setProperty("key1", "value1");
vr.setAttributes(props);
Map<String, Object> map = new HashMap<>();
map.put("key2", new Integer(2));
map.put("key2", 2);
vr.setAttributesMap(map);
vr.setApplicationContext(this.wac);
@@ -236,14 +236,14 @@ public class ViewResolverTests {
assertThat(((InternalResourceView) view).getUrl()).as("Correct URL").isEqualTo("example1");
Map<String, Object> attributes = ((InternalResourceView) view).getStaticAttributes();
assertThat(attributes.get("key1")).isEqualTo("value1");
assertThat(attributes.get("key2")).isEqualTo(new Integer(2));
assertThat(attributes.get("key2")).isEqualTo(2);
view = vr.resolveViewName("example2", Locale.getDefault());
assertThat(view).isInstanceOf(JstlView.class);
assertThat(((InternalResourceView) view).getUrl()).as("Correct URL").isEqualTo("example2");
attributes = ((InternalResourceView) view).getStaticAttributes();
assertThat(attributes.get("key1")).isEqualTo("value1");
assertThat(attributes.get("key2")).isEqualTo(new Integer(2));
assertThat(attributes.get("key2")).isEqualTo(2);
this.request.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, this.wac);
this.request.setAttribute(DispatcherServlet.LOCALE_RESOLVER_ATTRIBUTE, new AcceptHeaderLocaleResolver());
@@ -255,7 +255,7 @@ public class ViewResolverTests {
assertThat(tb.equals(this.request.getAttribute("tb"))).as("Correct tb attribute").isTrue();
assertThat(this.request.getAttribute("rc") == null).as("Correct rc attribute").isTrue();
assertThat(this.request.getAttribute("key1")).isEqualTo("value1");
assertThat(this.request.getAttribute("key2")).isEqualTo(new Integer(2));
assertThat(this.request.getAttribute("key2")).isEqualTo(2);
}
@Test
@@ -268,7 +268,7 @@ public class ViewResolverTests {
props.setProperty("key1", "value1");
vr.setAttributes(props);
Map<String, Object> map = new HashMap<>();
map.put("key2", new Integer(2));
map.put("key2", 2);
vr.setAttributesMap(map);
vr.setExposeContextBeansAsAttributes(true);
vr.setApplicationContext(this.wac);
@@ -281,7 +281,7 @@ public class ViewResolverTests {
public void forward(ServletRequest forwardRequest, ServletResponse forwardResponse) {
assertThat(forwardRequest.getAttribute("rc") == null).as("Correct rc attribute").isTrue();
assertThat(forwardRequest.getAttribute("key1")).isEqualTo("value1");
assertThat(forwardRequest.getAttribute("key2")).isEqualTo(new Integer(2));
assertThat(forwardRequest.getAttribute("key2")).isEqualTo(2);
assertThat(forwardRequest.getAttribute("myBean")).isSameAs(wac.getBean("myBean"));
assertThat(forwardRequest.getAttribute("myBean2")).isSameAs(wac.getBean("myBean2"));
}
@@ -304,7 +304,7 @@ public class ViewResolverTests {
props.setProperty("key1", "value1");
vr.setAttributes(props);
Map<String, Object> map = new HashMap<>();
map.put("key2", new Integer(2));
map.put("key2", 2);
vr.setAttributesMap(map);
vr.setExposedContextBeanNames(new String[] {"myBean2"});
vr.setApplicationContext(this.wac);
@@ -317,7 +317,7 @@ public class ViewResolverTests {
public void forward(ServletRequest forwardRequest, ServletResponse forwardResponse) {
assertThat(forwardRequest.getAttribute("rc") == null).as("Correct rc attribute").isTrue();
assertThat(forwardRequest.getAttribute("key1")).isEqualTo("value1");
assertThat(forwardRequest.getAttribute("key2")).isEqualTo(new Integer(2));
assertThat(forwardRequest.getAttribute("key2")).isEqualTo(2);
assertThat(forwardRequest.getAttribute("myBean")).isNull();
assertThat(forwardRequest.getAttribute("myBean2")).isSameAs(wac.getBean("myBean2"));
}