@Test
  public void getEnumFromOrdinalWithColumnIndexWorks() throws SQLException {
    ResultSet mockResultSet = mock(ResultSet.class);
    when(mockResultSet.getInt(2)).thenReturn(0);

    assertEquals(TestEnum.FOO, ResultSets.getEnumFromOrdinal(mockResultSet, 2, TestEnum.class));
    assertEquals(
        TestEnum.FOO, ResultSets.enhance(mockResultSet).getEnumFromOrdinal(2, TestEnum.class));

    when(mockResultSet.getInt(2)).thenReturn(0);
    when(mockResultSet.wasNull()).thenReturn(true);
    assertNull(ResultSets.getEnumFromOrdinal(mockResultSet, 2, TestEnum.class));
    assertNull(ResultSets.enhance(mockResultSet).getEnumFromOrdinal(2, TestEnum.class));
  }
 @Test(expected = IllegalStateException.class)
 public void getEnumFromOrdinalWithColumnNameThrowsIllegalStateException() throws SQLException {
   ResultSet mockResultSet = mock(ResultSet.class);
   when(mockResultSet.getInt("enum_column")).thenReturn(2);
   ResultSets.getEnumFromOrdinal(mockResultSet, "enum_column", TestEnum.class);
 }