@@ -78,18 +78,14 @@ void testStaticScript() {
7878 assertThat (AopUtils .isAopProxy (calc )).as ("Shouldn't get proxy when refresh is disabled" ).isFalse ();
7979 assertThat (AopUtils .isAopProxy (messenger )).as ("Shouldn't get proxy when refresh is disabled" ).isFalse ();
8080
81- boolean condition3 = calc instanceof Refreshable ;
82- assertThat (condition3 ).as ("Scripted object should not be instance of Refreshable" ).isFalse ();
83- boolean condition2 = messenger instanceof Refreshable ;
84- assertThat (condition2 ).as ("Scripted object should not be instance of Refreshable" ).isFalse ();
81+ assertThat (calc instanceof Refreshable ).as ("Scripted object should not be instance of Refreshable" ).isFalse ();
82+ assertThat (messenger instanceof Refreshable ).as ("Scripted object should not be instance of Refreshable" ).isFalse ();
8583
8684 assertThat (calc ).isEqualTo (calc );
8785 assertThat (messenger ).isEqualTo (messenger );
88- boolean condition1 = !messenger .equals (calc );
89- assertThat (condition1 ).isTrue ();
86+ assertThat (messenger ).isNotEqualTo (calc );
9087 assertThat (messenger .hashCode ()).isNotEqualTo (calc .hashCode ());
91- boolean condition = !messenger .toString ().equals (calc .toString ());
92- assertThat (condition ).isTrue ();
88+ assertThat (messenger .toString ()).isNotEqualTo (calc .toString ());
9389
9490 String desiredMessage = "Hello World!" ;
9591 assertThat (messenger .getMessage ()).as ("Message is incorrect" ).isEqualTo (desiredMessage );
@@ -111,18 +107,14 @@ void testStaticScriptUsingJsr223() {
111107 assertThat (AopUtils .isAopProxy (calc )).as ("Shouldn't get proxy when refresh is disabled" ).isFalse ();
112108 assertThat (AopUtils .isAopProxy (messenger )).as ("Shouldn't get proxy when refresh is disabled" ).isFalse ();
113109
114- boolean condition3 = calc instanceof Refreshable ;
115- assertThat (condition3 ).as ("Scripted object should not be instance of Refreshable" ).isFalse ();
116- boolean condition2 = messenger instanceof Refreshable ;
117- assertThat (condition2 ).as ("Scripted object should not be instance of Refreshable" ).isFalse ();
110+ assertThat (calc instanceof Refreshable ).as ("Scripted object should not be instance of Refreshable" ).isFalse ();
111+ assertThat (messenger instanceof Refreshable ).as ("Scripted object should not be instance of Refreshable" ).isFalse ();
118112
119113 assertThat (calc ).isEqualTo (calc );
120114 assertThat (messenger ).isEqualTo (messenger );
121- boolean condition1 = !messenger .equals (calc );
122- assertThat (condition1 ).isTrue ();
115+ assertThat (messenger ).isNotEqualTo (calc );
123116 assertThat (messenger .hashCode ()).isNotEqualTo (calc .hashCode ());
124- boolean condition = !messenger .toString ().equals (calc .toString ());
125- assertThat (condition ).isTrue ();
117+ assertThat (messenger .toString ()).isNotEqualTo (calc .toString ());
126118
127119 String desiredMessage = "Hello World!" ;
128120 assertThat (messenger .getMessage ()).as ("Message is incorrect" ).isEqualTo (desiredMessage );
@@ -138,8 +130,7 @@ void testStaticPrototypeScript() {
138130 ConfigurableMessenger messenger2 = (ConfigurableMessenger ) ctx .getBean ("messengerPrototype" );
139131
140132 assertThat (AopUtils .isAopProxy (messenger )).as ("Shouldn't get proxy when refresh is disabled" ).isFalse ();
141- boolean condition = messenger instanceof Refreshable ;
142- assertThat (condition ).as ("Scripted object should not be instance of Refreshable" ).isFalse ();
133+ assertThat (messenger instanceof Refreshable ).as ("Scripted object should not be instance of Refreshable" ).isFalse ();
143134
144135 assertThat (messenger2 ).isNotSameAs (messenger );
145136 assertThat (messenger2 .getClass ()).isSameAs (messenger .getClass ());
@@ -158,8 +149,7 @@ void testStaticPrototypeScriptUsingJsr223() {
158149 ConfigurableMessenger messenger2 = (ConfigurableMessenger ) ctx .getBean ("messengerPrototype" );
159150
160151 assertThat (AopUtils .isAopProxy (messenger )).as ("Shouldn't get proxy when refresh is disabled" ).isFalse ();
161- boolean condition = messenger instanceof Refreshable ;
162- assertThat (condition ).as ("Scripted object should not be instance of Refreshable" ).isFalse ();
152+ assertThat (messenger instanceof Refreshable ).as ("Scripted object should not be instance of Refreshable" ).isFalse ();
163153
164154 assertThat (messenger2 ).isNotSameAs (messenger );
165155 assertThat (messenger2 .getClass ()).isSameAs (messenger .getClass ());
@@ -178,8 +168,7 @@ void testStaticScriptWithInstance() {
178168 Messenger messenger = (Messenger ) ctx .getBean ("messengerInstance" );
179169
180170 assertThat (AopUtils .isAopProxy (messenger )).as ("Shouldn't get proxy when refresh is disabled" ).isFalse ();
181- boolean condition = messenger instanceof Refreshable ;
182- assertThat (condition ).as ("Scripted object should not be instance of Refreshable" ).isFalse ();
171+ assertThat (messenger instanceof Refreshable ).as ("Scripted object should not be instance of Refreshable" ).isFalse ();
183172
184173 String desiredMessage = "Hello World!" ;
185174 assertThat (messenger .getMessage ()).as ("Message is incorrect" ).isEqualTo (desiredMessage );
@@ -193,8 +182,7 @@ void testStaticScriptWithInstanceUsingJsr223() {
193182 Messenger messenger = (Messenger ) ctx .getBean ("messengerInstance" );
194183
195184 assertThat (AopUtils .isAopProxy (messenger )).as ("Shouldn't get proxy when refresh is disabled" ).isFalse ();
196- boolean condition = messenger instanceof Refreshable ;
197- assertThat (condition ).as ("Scripted object should not be instance of Refreshable" ).isFalse ();
185+ assertThat (messenger instanceof Refreshable ).as ("Scripted object should not be instance of Refreshable" ).isFalse ();
198186
199187 String desiredMessage = "Hello World!" ;
200188 assertThat (messenger .getMessage ()).as ("Message is incorrect" ).isEqualTo (desiredMessage );
@@ -208,8 +196,7 @@ void testStaticScriptWithInlineDefinedInstance() {
208196 Messenger messenger = (Messenger ) ctx .getBean ("messengerInstanceInline" );
209197
210198 assertThat (AopUtils .isAopProxy (messenger )).as ("Shouldn't get proxy when refresh is disabled" ).isFalse ();
211- boolean condition = messenger instanceof Refreshable ;
212- assertThat (condition ).as ("Scripted object should not be instance of Refreshable" ).isFalse ();
199+ assertThat (messenger instanceof Refreshable ).as ("Scripted object should not be instance of Refreshable" ).isFalse ();
213200
214201 String desiredMessage = "Hello World!" ;
215202 assertThat (messenger .getMessage ()).as ("Message is incorrect" ).isEqualTo (desiredMessage );
@@ -223,8 +210,7 @@ void testStaticScriptWithInlineDefinedInstanceUsingJsr223() {
223210 Messenger messenger = (Messenger ) ctx .getBean ("messengerInstanceInline" );
224211
225212 assertThat (AopUtils .isAopProxy (messenger )).as ("Shouldn't get proxy when refresh is disabled" ).isFalse ();
226- boolean condition = messenger instanceof Refreshable ;
227- assertThat (condition ).as ("Scripted object should not be instance of Refreshable" ).isFalse ();
213+ assertThat (messenger instanceof Refreshable ).as ("Scripted object should not be instance of Refreshable" ).isFalse ();
228214
229215 String desiredMessage = "Hello World!" ;
230216 assertThat (messenger .getMessage ()).as ("Message is incorrect" ).isEqualTo (desiredMessage );
@@ -237,8 +223,7 @@ void testNonStaticScript() {
237223 Messenger messenger = (Messenger ) ctx .getBean ("messenger" );
238224
239225 assertThat (AopUtils .isAopProxy (messenger )).as ("Should be a proxy for refreshable scripts" ).isTrue ();
240- boolean condition = messenger instanceof Refreshable ;
241- assertThat (condition ).as ("Should be an instance of Refreshable" ).isTrue ();
226+ assertThat (messenger instanceof Refreshable ).as ("Should be an instance of Refreshable" ).isTrue ();
242227
243228 String desiredMessage = "Hello World!" ;
244229 assertThat (messenger .getMessage ()).as ("Message is incorrect" ).isEqualTo (desiredMessage );
@@ -257,8 +242,7 @@ void testNonStaticPrototypeScript() {
257242 ConfigurableMessenger messenger2 = (ConfigurableMessenger ) ctx .getBean ("messengerPrototype" );
258243
259244 assertThat (AopUtils .isAopProxy (messenger )).as ("Should be a proxy for refreshable scripts" ).isTrue ();
260- boolean condition = messenger instanceof Refreshable ;
261- assertThat (condition ).as ("Should be an instance of Refreshable" ).isTrue ();
245+ assertThat (messenger instanceof Refreshable ).as ("Should be an instance of Refreshable" ).isTrue ();
262246
263247 assertThat (messenger .getMessage ()).isEqualTo ("Hello World!" );
264248 assertThat (messenger2 .getMessage ()).isEqualTo ("Hello World!" );
@@ -371,8 +355,7 @@ void testResourceScriptFromTag() {
371355 CallCounter countingAspect = (CallCounter ) ctx .getBean ("getMessageAspect" );
372356
373357 assertThat (AopUtils .isAopProxy (messenger )).isTrue ();
374- boolean condition = messenger instanceof Refreshable ;
375- assertThat (condition ).isFalse ();
358+ assertThat (messenger instanceof Refreshable ).isFalse ();
376359 assertThat (countingAspect .getCalls ()).isEqualTo (0 );
377360 assertThat (messenger .getMessage ()).isEqualTo ("Hello World!" );
378361 assertThat (countingAspect .getCalls ()).isEqualTo (1 );
@@ -404,8 +387,7 @@ void testInlineScriptFromTag() {
404387 assertThat (ObjectUtils .containsElement (bd .getDependsOn (), "messenger" )).isTrue ();
405388 Calculator calculator = (Calculator ) ctx .getBean ("calculator" );
406389 assertThat (calculator ).isNotNull ();
407- boolean condition = calculator instanceof Refreshable ;
408- assertThat (condition ).isFalse ();
390+ assertThat (calculator instanceof Refreshable ).isFalse ();
409391 }
410392
411393 @ Test
@@ -417,8 +399,7 @@ void testRefreshableFromTag() {
417399 CallCounter countingAspect = (CallCounter ) ctx .getBean ("getMessageAspect" );
418400
419401 assertThat (AopUtils .isAopProxy (messenger )).isTrue ();
420- boolean condition = messenger instanceof Refreshable ;
421- assertThat (condition ).isTrue ();
402+ assertThat (messenger instanceof Refreshable ).isTrue ();
422403 assertThat (countingAspect .getCalls ()).isEqualTo (0 );
423404 assertThat (messenger .getMessage ()).isEqualTo ("Hello World!" );
424405 assertThat (countingAspect .getCalls ()).isEqualTo (1 );
@@ -435,8 +416,7 @@ public void testRefreshableFromTagProxyTargetClass() {
435416 Messenger messenger = (Messenger ) ctx .getBean ("refreshableMessenger" );
436417
437418 assertThat (AopUtils .isAopProxy (messenger )).isTrue ();
438- boolean condition = messenger instanceof Refreshable ;
439- assertThat (condition ).isTrue ();
419+ assertThat (messenger instanceof Refreshable ).isTrue ();
440420 assertThat (messenger .getMessage ()).isEqualTo ("Hello World!" );
441421
442422 assertThat (ctx .getBeansOfType (ConcreteMessenger .class )).containsValue ((ConcreteMessenger ) messenger );
@@ -487,8 +467,7 @@ void testRefreshableJsr223FromTag() {
487467 assertThat (Arrays .asList (ctx .getBeanNamesForType (Messenger .class ))).contains ("refreshableMessenger" );
488468 Messenger messenger = (Messenger ) ctx .getBean ("refreshableMessenger" );
489469 assertThat (AopUtils .isAopProxy (messenger )).isTrue ();
490- boolean condition = messenger instanceof Refreshable ;
491- assertThat (condition ).isTrue ();
470+ assertThat (messenger instanceof Refreshable ).isTrue ();
492471 assertThat (messenger .getMessage ()).isEqualTo ("Hello World!" );
493472 }
494473
@@ -542,32 +521,26 @@ private void testMetaClass(String xmlFile) {
542521 // expect the exception we threw in the custom metaclass to show it got invoked
543522 ApplicationContext ctx = new ClassPathXmlApplicationContext (xmlFile );
544523 Calculator calc = (Calculator ) ctx .getBean ("delegatingCalculator" );
545- assertThatIllegalStateException (). isThrownBy (() ->
546- calc .add (1 , 2 ))
547- .withMessage ("Gotcha" );
524+ assertThatIllegalStateException ()
525+ . isThrownBy (() -> calc .add (1 , 2 ))
526+ .withMessage ("Gotcha" );
548527 }
549528
550529 @ Test
551530 void testFactoryBean () {
552531 ApplicationContext context = new ClassPathXmlApplicationContext ("groovyContext.xml" , getClass ());
553532 Object factory = context .getBean ("&factory" );
554- boolean condition1 = factory instanceof FactoryBean ;
555- assertThat (condition1 ).isTrue ();
533+ assertThat (factory instanceof FactoryBean ).isTrue ();
556534 Object result = context .getBean ("factory" );
557- boolean condition = result instanceof String ;
558- assertThat (condition ).isTrue ();
559535 assertThat (result ).isEqualTo ("test" );
560536 }
561537
562538 @ Test
563539 void testRefreshableFactoryBean () {
564540 ApplicationContext context = new ClassPathXmlApplicationContext ("groovyContext.xml" , getClass ());
565541 Object factory = context .getBean ("&refreshableFactory" );
566- boolean condition1 = factory instanceof FactoryBean ;
567- assertThat (condition1 ).isTrue ();
542+ assertThat (factory instanceof FactoryBean ).isTrue ();
568543 Object result = context .getBean ("refreshableFactory" );
569- boolean condition = result instanceof String ;
570- assertThat (condition ).isTrue ();
571544 assertThat (result ).isEqualTo ("test" );
572545 }
573546
0 commit comments