ecki commented on code in PR #218:
URL: https://github.com/apache/commons-dbutils/pull/218#discussion_r1405177811


##########
src/test/java/org/apache/commons/dbutils/BeanProcessorTest.java:
##########
@@ -213,93 +214,90 @@ public void testCheckAnnotationOnMissingReadMethod() 
throws Exception {
      * @see <a 
href="https://issues.apache.org/jira/browse/DBUTILS-150";>DBUTILS-150</a>
      */
     public void testIndexedPropertyDescriptor() throws Exception {
-        final String[] colNames = {"name", "things", "stuff"};
-        final ResultSetMetaData metaData = 
MockResultSetMetaData.create(colNames);
+        final String[] columnNames = {"name", "things", "stuff"};
+        final ResultSetMetaData metaData = 
MockResultSetMetaData.create(columnNames);
 
-        final String name = "first";
-        final List<String> things = Arrays.asList("1", "2", "3", "4");
-        final List<String> stuff = things;
+        final String nameHeaderData = "first";
+        final List<String> thingsHeaderData = Arrays.asList("1", "2", "3", 
"4");
+        final List<String> stuffHeaderData = thingsHeaderData;
         final Object[][] rows = {
-                new Object[] {name, things, stuff}
+                new Object[] {nameHeaderData, thingsHeaderData, 
stuffHeaderData}
         };
 
-        final ResultSet rs = MockResultSet.create(metaData, rows);
-        assertTrue(rs.next());
-        IndexedPropertyTestClass testCls = new IndexedPropertyTestClass();
-        testCls = beanProc.populateBean(rs, testCls);
-        assertEquals(name, testCls.getName());
-        assertArrayEquals(things.toArray(), testCls.getThings().toArray());
-        assertArrayEquals(stuff.toArray(), testCls.getStuff().toArray());
+        final ResultSet resultSet = MockResultSet.create(metaData, rows);
+        assertTrue(resultSet.next());
+        IndexedPropertyTestClass indexedPropertyTestClass = new 
IndexedPropertyTestClass();
+        indexedPropertyTestClass = BEAN_PROCESSOR.populateBean(resultSet, 
indexedPropertyTestClass);
+        assertEquals(nameHeaderData, indexedPropertyTestClass.getName());
+        assertArrayEquals(thingsHeaderData.toArray(), 
indexedPropertyTestClass.getThings().toArray());
+        assertArrayEquals(stuffHeaderData.toArray(), 
indexedPropertyTestClass.getStuff().toArray());
     }
 
     public void testMapColumnToAnnotationField() throws Exception {
         final String[] columnNames = { "test", "test", "three_" };
         final String[] columnLabels = { "one", "two", null };
-        final ResultSetMetaData rsmd = 
ProxyFactory.instance().createResultSetMetaData(
-                new MockResultSetMetaData(columnNames, columnLabels));
+        final ResultSetMetaData resultSetMetaData = 
buildResultSetMetaData(columnNames, columnLabels);
         final PropertyDescriptor[] props = 
Introspector.getBeanInfo(MapColumnToAnnotationFieldBean.class).getPropertyDescriptors();
 
-        final int[] columns = beanProc.mapColumnsToProperties(rsmd, props);
+        final int[] columns = 
BEAN_PROCESSOR.mapColumnsToProperties(resultSetMetaData, props);
         for (int i = 1; i < columns.length; i++) {
-            assertTrue(columns[i] != BeanProcessor.PROPERTY_NOT_FOUND);
+            assertNotEquals(columns[i], BeanProcessor.PROPERTY_NOT_FOUND);

Review Comment:
   The expected value should be first in asserts.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to