### Question:
ReusableResultSet extends DecorateResultSet { public SwiftResultSet reuse() throws SQLException { return new IterableResultSet(rows, getMetaData(), getFetchSize()); } ReusableResultSet(SwiftResultSet originResultSet); SwiftResultSet reuse();  }### Answer:
@Test public void reuse() throws SQLException { SwiftResultSet origin = mock(SwiftResultSet.class, Mockito.RETURNS_DEEP_STUBS); when(origin.getFetchSize()).thenReturn(1); when(origin.hasNext()).thenReturn(true, true, false); Row row0 = mock(Row.class), row1 = mock(Row.class); when(origin.getNextRow()).thenReturn(row0, row1); SwiftResultSet resultSet = new ReusableResultSet(origin); verify(origin).close(); assertEquals(origin.getFetchSize(), resultSet.getFetchSize()); assertEquals(origin.getMetaData(), resultSet.getMetaData()); assertTrue(resultSet.hasNext()); assertEquals(row0, resultSet.getNextRow()); assertTrue(resultSet.hasNext()); assertEquals(row1, resultSet.getNextRow()); assertFalse(resultSet.hasNext()); resultSet = ((ReusableResultSet) resultSet).reuse(); assertEquals(origin.getFetchSize(), resultSet.getFetchSize()); assertEquals(origin.getMetaData(), resultSet.getMetaData()); assertTrue(resultSet.hasNext()); assertEquals(row0, resultSet.getNextRow()); assertTrue(resultSet.hasNext()); assertEquals(row1, resultSet.getNextRow()); assertFalse(resultSet.hasNext()); }