11/*
2- * Copyright 2002-2020 the original author or authors.
2+ * Copyright 2002-2024 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
3939 * @author Juergen Hoeller
4040 * @author Chris Beams
4141 */
42- public class ScopedProxyTests {
42+ class ScopedProxyTests {
4343
4444 private static final Class <?> CLASS = ScopedProxyTests .class ;
4545 private static final String CLASSNAME = CLASS .getSimpleName ();
@@ -51,27 +51,24 @@ public class ScopedProxyTests {
5151
5252
5353 @ Test // SPR-2108
54- public void testProxyAssignable () throws Exception {
54+ void testProxyAssignable () {
5555 DefaultListableBeanFactory bf = new DefaultListableBeanFactory ();
5656 new XmlBeanDefinitionReader (bf ).loadBeanDefinitions (MAP_CONTEXT );
5757 Object baseMap = bf .getBean ("singletonMap" );
58- boolean condition = baseMap instanceof Map ;
59- assertThat (condition ).isTrue ();
58+ assertThat (baseMap instanceof Map ).isTrue ();
6059 }
6160
6261 @ Test
63- public void testSimpleProxy () throws Exception {
62+ void testSimpleProxy () {
6463 DefaultListableBeanFactory bf = new DefaultListableBeanFactory ();
6564 new XmlBeanDefinitionReader (bf ).loadBeanDefinitions (MAP_CONTEXT );
6665 Object simpleMap = bf .getBean ("simpleMap" );
67- boolean condition1 = simpleMap instanceof Map ;
68- assertThat (condition1 ).isTrue ();
69- boolean condition = simpleMap instanceof HashMap ;
70- assertThat (condition ).isTrue ();
66+ assertThat (simpleMap instanceof Map ).isTrue ();
67+ assertThat (simpleMap instanceof HashMap ).isTrue ();
7168 }
7269
7370 @ Test
74- public void testScopedOverride () throws Exception {
71+ void testScopedOverride () {
7572 GenericApplicationContext ctx = new GenericApplicationContext ();
7673 new XmlBeanDefinitionReader (ctx ).loadBeanDefinitions (OVERRIDE_CONTEXT );
7774 SimpleMapScope scope = new SimpleMapScope ();
@@ -87,7 +84,7 @@ public void testScopedOverride() throws Exception {
8784 }
8885
8986 @ Test
90- public void testJdkScopedProxy () throws Exception {
87+ void testJdkScopedProxy () throws Exception {
9188 DefaultListableBeanFactory bf = new DefaultListableBeanFactory ();
9289 new XmlBeanDefinitionReader (bf ).loadBeanDefinitions (TESTBEAN_CONTEXT );
9390 bf .setSerializationId ("X" );
@@ -97,8 +94,7 @@ public void testJdkScopedProxy() throws Exception {
9794 ITestBean bean = (ITestBean ) bf .getBean ("testBean" );
9895 assertThat (bean ).isNotNull ();
9996 assertThat (AopUtils .isJdkDynamicProxy (bean )).isTrue ();
100- boolean condition1 = bean instanceof ScopedObject ;
101- assertThat (condition1 ).isTrue ();
97+ assertThat (bean instanceof ScopedObject ).isTrue ();
10298 ScopedObject scoped = (ScopedObject ) bean ;
10399 assertThat (scoped .getTargetObject ().getClass ()).isEqualTo (TestBean .class );
104100 bean .setAge (101 );
@@ -110,16 +106,15 @@ public void testJdkScopedProxy() throws Exception {
110106 assertThat (deserialized ).isNotNull ();
111107 assertThat (AopUtils .isJdkDynamicProxy (deserialized )).isTrue ();
112108 assertThat (bean .getAge ()).isEqualTo (101 );
113- boolean condition = deserialized instanceof ScopedObject ;
114- assertThat (condition ).isTrue ();
109+ assertThat (deserialized instanceof ScopedObject ).isTrue ();
115110 ScopedObject scopedDeserialized = (ScopedObject ) deserialized ;
116111 assertThat (scopedDeserialized .getTargetObject ().getClass ()).isEqualTo (TestBean .class );
117112
118113 bf .setSerializationId (null );
119114 }
120115
121116 @ Test
122- public void testCglibScopedProxy () throws Exception {
117+ void testCglibScopedProxy () throws Exception {
123118 DefaultListableBeanFactory bf = new DefaultListableBeanFactory ();
124119 new XmlBeanDefinitionReader (bf ).loadBeanDefinitions (LIST_CONTEXT );
125120 bf .setSerializationId ("Y" );
@@ -128,21 +123,19 @@ public void testCglibScopedProxy() throws Exception {
128123
129124 TestBean tb = (TestBean ) bf .getBean ("testBean" );
130125 assertThat (AopUtils .isCglibProxy (tb .getFriends ())).isTrue ();
131- boolean condition1 = tb .getFriends () instanceof ScopedObject ;
132- assertThat (condition1 ).isTrue ();
126+ assertThat (tb .getFriends () instanceof ScopedObject ).isTrue ();
133127 ScopedObject scoped = (ScopedObject ) tb .getFriends ();
134128 assertThat (scoped .getTargetObject ().getClass ()).isEqualTo (ArrayList .class );
135129 tb .getFriends ().add ("myFriend" );
136130
137131 assertThat (scope .getMap ().containsKey ("scopedTarget.scopedList" )).isTrue ();
138132 assertThat (scope .getMap ().get ("scopedTarget.scopedList" ).getClass ()).isEqualTo (ArrayList .class );
139133
140- ArrayList <? > deserialized = (ArrayList <? >) SerializationTestUtils .serializeAndDeserialize (tb .getFriends ());
134+ ArrayList <Object > deserialized = (ArrayList <Object >) SerializationTestUtils .serializeAndDeserialize (tb .getFriends ());
141135 assertThat (deserialized ).isNotNull ();
142136 assertThat (AopUtils .isCglibProxy (deserialized )).isTrue ();
143- assertThat (deserialized .contains ("myFriend" )).isTrue ();
144- boolean condition = deserialized instanceof ScopedObject ;
145- assertThat (condition ).isTrue ();
137+ assertThat (deserialized ).contains ("myFriend" );
138+ assertThat (deserialized instanceof ScopedObject ).isTrue ();
146139 ScopedObject scopedDeserialized = (ScopedObject ) deserialized ;
147140 assertThat (scopedDeserialized .getTargetObject ().getClass ()).isEqualTo (ArrayList .class );
148141
0 commit comments