### Question:
ResultSetColumnReader { public Boolean getBoolean(int columnIdx) throws SQLException { Object obj = _rs.getObject(columnIdx); Boolean results = Boolean.FALSE; _wasNull = true; if (obj != null) { final int columnType = _rsmd.getColumnType(columnIdx); if (columnType != Types.NULL) { _wasNull = false; switch (columnType) { case Types.BIT: case Types.BOOLEAN: if (obj instanceof Boolean) { results = (Boolean)obj; } else { if (obj instanceof Number) { if (((Number)obj).intValue() == 0) { results = Boolean.FALSE; } else { results = Boolean.TRUE; } } else { results = Boolean.valueOf(obj.toString()); } } break; default: results = Boolean.valueOf(obj.toString()); break; } } } return results; } ResultSetColumnReader(ResultSet rs); boolean next(); Boolean getBoolean(int columnIdx); Date getDate(int columnIdx); Double getDouble(int columnIdx); Long getLong(int columnIdx); Object getObject(int columnIdx); String getString(int columnIdx); Time getTime(int columnIdx); Timestamp getTimeStamp(int columnIdx); boolean wasNull();  }### Answer:
@Test public final void testGetBoolean() throws SQLException { int index = 1; expect(mockResultSetMetaData.getColumnType(index++)).andReturn(Types.BIT); expect(mockResultSetMetaData.getColumnType(index++)).andReturn(Types.BIT); expect(mockResultSetMetaData.getColumnType(index++)).andReturn(Types.BOOLEAN); expect(mockResultSetMetaData.getColumnType(index++)).andReturn(Types.BOOLEAN); expect(mockResultSetMetaData.getColumnType(index++)).andReturn(Types.BOOLEAN); expect(mockResultSetMetaData.getColumnType(index++)).andReturn(Types.VARCHAR); expect(mockResultSetMetaData.getColumnType(index++)).andReturn(Types.VARCHAR); index = 1; expect(mockResultSet.getMetaData()).andReturn(mockResultSetMetaData).anyTimes(); expect(mockResultSet.getObject(index++)).andReturn(Boolean.valueOf(true)).anyTimes(); expect(mockResultSet.getObject(index++)).andReturn(Boolean.valueOf(false)).anyTimes(); expect(mockResultSet.getObject(index++)).andReturn(Long.valueOf(1)).anyTimes(); expect(mockResultSet.getObject(index++)).andReturn(Short.valueOf((short)0)).anyTimes(); expect(mockResultSet.getObject(index++)).andReturn("true").anyTimes(); expect(mockResultSet.getObject(index++)).andReturn("false").anyTimes(); expect(mockResultSet.getObject(index++)).andReturn("true").anyTimes(); index = 1; replayAll(); readerUnderTest = new ResultSetColumnReader(mockResultSet); Boolean value = readerUnderTest.getBoolean(index++); assertEquals(true, value); value = readerUnderTest.getBoolean(index++); assertEquals(false, value); value = readerUnderTest.getBoolean(index++); assertEquals(true, value); value = readerUnderTest.getBoolean(index++); assertEquals(false, value); value = readerUnderTest.getBoolean(index++); assertEquals(true, value); value = readerUnderTest.getBoolean(index++); assertEquals(false, value); value = readerUnderTest.getBoolean(index++); assertEquals(true, value); verifyAll(); }