Skip to content

Commit 60cee7f

Browse files
committed
Polish ExtendedBeanInfoTests regarding JDK 8u40 compatibility
This commit simplifies the test for greater clarify and swaps the 'expected' and 'actual' arguments passed to assertEquals(). Issue: SPR-12582
1 parent 7492129 commit 60cee7f

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535

3636
/**
3737
* @author Chris Beams
38+
* @author Juergen Hoeller
39+
* @author Sam Brannen
3840
* @since 3.1
3941
*/
4042
public class ExtendedBeanInfoTests {
@@ -834,32 +836,26 @@ public boolean isTargetMethod() {
834836
}
835837

836838
@Test
837-
public void cornerSpr8937() throws IntrospectionException {
839+
public void cornerSpr8937AndSpr12582() throws IntrospectionException {
838840
@SuppressWarnings("unused") class A {
839841
public void setAddress(String addr){ }
840842
public void setAddress(int index, String addr) { }
841843
public String getAddress(int index){ return null; }
842844
}
843845

844-
// Baseline: ExtendedBeanInfo needs to behave exactly like the following...
845-
boolean hasReadMethod;
846-
boolean hasWriteMethod;
847-
boolean hasIndexedReadMethod;
848-
boolean hasIndexedWriteMethod;
849-
{
850-
BeanInfo bi = Introspector.getBeanInfo(A.class);
851-
hasReadMethod = hasReadMethodForProperty(bi, "address");
852-
hasWriteMethod = hasWriteMethodForProperty(bi, "address");
853-
hasIndexedReadMethod = hasIndexedReadMethodForProperty(bi, "address");
854-
hasIndexedWriteMethod = hasIndexedWriteMethodForProperty(bi, "address");
855-
}
856-
{
857-
BeanInfo bi = new ExtendedBeanInfo(Introspector.getBeanInfo(A.class));
858-
assertEquals(hasReadMethodForProperty(bi, "address"), hasReadMethod);
859-
assertEquals(hasWriteMethodForProperty(bi, "address"), hasWriteMethod);
860-
assertEquals(hasIndexedReadMethodForProperty(bi, "address"), hasIndexedReadMethod);
861-
assertEquals(hasIndexedWriteMethodForProperty(bi, "address"), hasIndexedWriteMethod);
862-
}
846+
// Baseline:
847+
BeanInfo bi = Introspector.getBeanInfo(A.class);
848+
boolean hasReadMethod = hasReadMethodForProperty(bi, "address");
849+
boolean hasWriteMethod = hasWriteMethodForProperty(bi, "address");
850+
boolean hasIndexedReadMethod = hasIndexedReadMethodForProperty(bi, "address");
851+
boolean hasIndexedWriteMethod = hasIndexedWriteMethodForProperty(bi, "address");
852+
853+
// ExtendedBeanInfo needs to behave exactly like BeanInfo...
854+
BeanInfo ebi = new ExtendedBeanInfo(bi);
855+
assertEquals(hasReadMethod, hasReadMethodForProperty(ebi, "address"));
856+
assertEquals(hasWriteMethod, hasWriteMethodForProperty(ebi, "address"));
857+
assertEquals(hasIndexedReadMethod, hasIndexedReadMethodForProperty(ebi, "address"));
858+
assertEquals(hasIndexedWriteMethod, hasIndexedWriteMethodForProperty(ebi, "address"));
863859
}
864860

865861
@Test

0 commit comments

Comments
 (0)