This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch 1.X in repository https://gitbox.apache.org/repos/asf/commons-beanutils.git
commit 5bc813181ddfe97bcf3fe5e60315132fdac59f15 Author: Gary Gregory <[email protected]> AuthorDate: Sun Aug 18 08:40:16 2024 -0400 Remove redundant parentheses --- .../commons/beanutils/BeanificationTestCase.java | 28 ++++++++++++---------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/test/java/org/apache/commons/beanutils/BeanificationTestCase.java b/src/test/java/org/apache/commons/beanutils/BeanificationTestCase.java index 188add88..8108db68 100644 --- a/src/test/java/org/apache/commons/beanutils/BeanificationTestCase.java +++ b/src/test/java/org/apache/commons/beanutils/BeanificationTestCase.java @@ -117,7 +117,7 @@ public class BeanificationTestCase extends TestCase { * Return the tests included in this test suite. */ public static Test suite() { - return (new TestSuite(BeanificationTestCase.class)); + return new TestSuite(BeanificationTestCase.class); } @@ -213,6 +213,7 @@ public class BeanificationTestCase extends TestCase { try { signal.setSignal(3); ConvertUtils.register(new Converter() { + @Override public <T> T convert(final Class<T> type, final Object value) { return ConvertUtils.primitiveToWrapper(type).cast(new Integer(9)); } @@ -235,6 +236,7 @@ public class BeanificationTestCase extends TestCase { assertEquals("Wrong property value (1)", 1, bean.getInt()); ConvertUtils.register(new Converter() { + @Override public <T> T convert(final Class<T> type, final Object value) { return ConvertUtils.primitiveToWrapper(type).cast(new Integer(5)); } @@ -286,7 +288,7 @@ public class BeanificationTestCase extends TestCase { } } - final ContextClassLoaderLocal<Integer> ccll = new ContextClassLoaderLocal<Integer>(); + final ContextClassLoaderLocal<Integer> ccll = new ContextClassLoaderLocal<>(); ccll.set(new Integer(1776)); assertEquals("Start thread sets value", new Integer(1776), ccll.get()); @@ -307,7 +309,7 @@ public class BeanificationTestCase extends TestCase { /** Tests whether the unset method works*/ public void testContextClassLoaderUnset() throws Exception { final BeanUtilsBean beanOne = new BeanUtilsBean(); - final ContextClassLoaderLocal<BeanUtilsBean> ccll = new ContextClassLoaderLocal<BeanUtilsBean>(); + final ContextClassLoaderLocal<BeanUtilsBean> ccll = new ContextClassLoaderLocal<>(); ccll.set(beanOne); assertEquals("Start thread gets right instance", beanOne, ccll.get()); ccll.unset(); @@ -372,7 +374,7 @@ public class BeanificationTestCase extends TestCase { // many thanks to Juozas Baliuka for suggesting this methodology TestClassLoader loader = new TestClassLoader(); - final WeakReference<ClassLoader> loaderReference = new WeakReference<ClassLoader>(loader); + final WeakReference<ClassLoader> loaderReference = new WeakReference<>(loader); BeanUtilsBean.getInstance(); class GetBeanUtilsBeanThread extends Thread { @@ -402,15 +404,15 @@ public class BeanificationTestCase extends TestCase { GetBeanUtilsBeanThread thread = new GetBeanUtilsBeanThread(); @SuppressWarnings("unused") final - WeakReference<Thread> threadWeakReference = new WeakReference<Thread>(thread); + WeakReference<Thread> threadWeakReference = new WeakReference<>(thread); thread.setContextClassLoader(loader); thread.start(); thread.join(); - final WeakReference<BeanUtilsBean> beanUtilsReference = new WeakReference<BeanUtilsBean>(thread.beanUtils); - final WeakReference<PropertyUtilsBean> propertyUtilsReference = new WeakReference<PropertyUtilsBean>(thread.propertyUtils); - final WeakReference<ConvertUtilsBean> convertUtilsReference = new WeakReference<ConvertUtilsBean>(thread.convertUtils); + final WeakReference<BeanUtilsBean> beanUtilsReference = new WeakReference<>(thread.beanUtils); + final WeakReference<PropertyUtilsBean> propertyUtilsReference = new WeakReference<>(thread.propertyUtils); + final WeakReference<ConvertUtilsBean> convertUtilsReference = new WeakReference<>(thread.convertUtils); assertNotNull("Weak reference released early (1)", loaderReference.get()); assertNotNull("Weak reference released early (2)", beanUtilsReference.get()); @@ -460,13 +462,13 @@ public class BeanificationTestCase extends TestCase { // many thanks to Juozas Baliuka for suggesting this methodology TestClassLoader loader = new TestClassLoader(); - final ReferenceQueue<Object> queue = new ReferenceQueue<Object>(); - final WeakReference<ClassLoader> loaderReference = new WeakReference<ClassLoader>(loader, queue); + final ReferenceQueue<Object> queue = new ReferenceQueue<>(); + final WeakReference<ClassLoader> loaderReference = new WeakReference<>(loader, queue); Integer test = new Integer(1); - final WeakReference<Integer> testReference = new WeakReference<Integer>(test, queue); + final WeakReference<Integer> testReference = new WeakReference<>(test, queue); //Map map = new ReferenceMap(ReferenceMap.WEAK, ReferenceMap.HARD, true); - final Map<Object, Object> map = new WeakHashMap<Object, Object>(); + final Map<Object, Object> map = new WeakHashMap<>(); map.put(loader, test); assertEquals("In map", test, map.get(loader)); @@ -506,7 +508,7 @@ public class BeanificationTestCase extends TestCase { // test methodology // many thanks to Juozas Baliuka for suggesting this method ClassLoader loader = new ClassLoader(this.getClass().getClassLoader()) {}; - final WeakReference<ClassLoader> reference = new WeakReference<ClassLoader>(loader); + final WeakReference<ClassLoader> reference = new WeakReference<>(loader); @SuppressWarnings("unused") Class<?> myClass = loader.loadClass("org.apache.commons.beanutils.BetaBean");
