@Test public void testAbstractLobStreamingResultSetExtractorNoRows() throws SQLException { ResultSet rset = mock(ResultSet.class); AbstractLobStreamingResultSetExtractor<Void> lobRse = getResultSetExtractor(false); thrown.expect(IncorrectResultSizeDataAccessException.class); try { lobRse.extractData(rset); } finally { verify(rset).next(); } }
@Test public void testAbstractLobStreamingResultSetExtractorCorrectException() throws SQLException { ResultSet rset = mock(ResultSet.class); given(rset.next()).willReturn(true); AbstractLobStreamingResultSetExtractor<Void> lobRse = getResultSetExtractor(true); thrown.expect(LobRetrievalFailureException.class); lobRse.extractData(rset); }
@Test public void testAbstractLobStreamingResultSetExtractorOneRow() throws SQLException { ResultSet rset = mock(ResultSet.class); given(rset.next()).willReturn(true, false); AbstractLobStreamingResultSetExtractor<Void> lobRse = getResultSetExtractor(false); lobRse.extractData(rset); verify(rset).clearWarnings(); }
@Test public void testAbstractLobStreamingResultSetExtractorMultipleRows() throws SQLException { ResultSet rset = mock(ResultSet.class); given(rset.next()).willReturn(true, true, false); AbstractLobStreamingResultSetExtractor<Void> lobRse = getResultSetExtractor(false); thrown.expect(IncorrectResultSizeDataAccessException.class); try { lobRse.extractData(rset); } finally { verify(rset).clearWarnings(); } }