23
23
24
24
import org .junit .jupiter .api .Test ;
25
25
26
- import org .springframework .dao .DataAccessException ;
27
26
import org .springframework .dao .IncorrectResultSizeDataAccessException ;
28
27
import org .springframework .jdbc .LobRetrievalFailureException ;
29
28
import org .springframework .jdbc .support .lob .LobCreator ;
@@ -55,11 +54,9 @@ class SetValuesCalled {
55
54
56
55
final SetValuesCalled svc = new SetValuesCalled ();
57
56
58
- AbstractLobCreatingPreparedStatementCallback psc = new AbstractLobCreatingPreparedStatementCallback (
59
- handler ) {
57
+ AbstractLobCreatingPreparedStatementCallback psc = new AbstractLobCreatingPreparedStatementCallback (handler ) {
60
58
@ Override
61
- protected void setValues (PreparedStatement ps , LobCreator lobCreator )
62
- throws SQLException , DataAccessException {
59
+ protected void setValues (PreparedStatement ps , LobCreator lobCreator ) {
63
60
svc .b = true ;
64
61
}
65
62
};
@@ -73,46 +70,43 @@ protected void setValues(PreparedStatement ps, LobCreator lobCreator)
73
70
74
71
@ Test
75
72
public void testAbstractLobStreamingResultSetExtractorNoRows () throws SQLException {
76
- ResultSet rset = mock ();
73
+ ResultSet rs = mock ();
77
74
AbstractLobStreamingResultSetExtractor <Void > lobRse = getResultSetExtractor (false );
78
- assertThatExceptionOfType (IncorrectResultSizeDataAccessException .class ). isThrownBy (() ->
79
- lobRse .extractData (rset ));
80
- verify (rset ).next ();
75
+ assertThatExceptionOfType (IncorrectResultSizeDataAccessException .class )
76
+ . isThrownBy (() -> lobRse .extractData (rs ));
77
+ verify (rs ).next ();
81
78
}
82
79
83
80
@ Test
84
81
public void testAbstractLobStreamingResultSetExtractorOneRow () throws SQLException {
85
- ResultSet rset = mock ();
86
- given (rset .next ()).willReturn (true , false );
82
+ ResultSet rs = mock ();
83
+ given (rs .next ()).willReturn (true , false );
87
84
AbstractLobStreamingResultSetExtractor <Void > lobRse = getResultSetExtractor (false );
88
- lobRse .extractData (rset );
89
- verify (rset ).clearWarnings ();
85
+ lobRse .extractData (rs );
86
+ verify (rs ).clearWarnings ();
90
87
}
91
88
92
89
@ Test
93
- public void testAbstractLobStreamingResultSetExtractorMultipleRows ()
94
- throws SQLException {
95
- ResultSet rset = mock ();
96
- given (rset .next ()).willReturn (true , true , false );
90
+ public void testAbstractLobStreamingResultSetExtractorMultipleRows () throws SQLException {
91
+ ResultSet rs = mock ();
92
+ given (rs .next ()).willReturn (true , true , false );
97
93
AbstractLobStreamingResultSetExtractor <Void > lobRse = getResultSetExtractor (false );
98
- assertThatExceptionOfType (IncorrectResultSizeDataAccessException .class ). isThrownBy (() ->
99
- lobRse .extractData (rset ));
100
- verify (rset ).clearWarnings ();
94
+ assertThatExceptionOfType (IncorrectResultSizeDataAccessException .class )
95
+ . isThrownBy (() -> lobRse .extractData (rs ));
96
+ verify (rs ).clearWarnings ();
101
97
}
102
98
103
99
@ Test
104
- public void testAbstractLobStreamingResultSetExtractorCorrectException ()
105
- throws SQLException {
106
- ResultSet rset = mock ();
107
- given (rset .next ()).willReturn (true );
100
+ public void testAbstractLobStreamingResultSetExtractorCorrectException () throws SQLException {
101
+ ResultSet rs = mock ();
102
+ given (rs .next ()).willReturn (true );
108
103
AbstractLobStreamingResultSetExtractor <Void > lobRse = getResultSetExtractor (true );
109
- assertThatExceptionOfType (LobRetrievalFailureException .class ). isThrownBy (() ->
110
- lobRse .extractData (rset ));
104
+ assertThatExceptionOfType (LobRetrievalFailureException .class )
105
+ . isThrownBy (() -> lobRse .extractData (rs ));
111
106
}
112
107
113
108
private AbstractLobStreamingResultSetExtractor <Void > getResultSetExtractor (final boolean ex ) {
114
109
AbstractLobStreamingResultSetExtractor <Void > lobRse = new AbstractLobStreamingResultSetExtractor <>() {
115
-
116
110
@ Override
117
111
protected void streamData (ResultSet rs ) throws SQLException , IOException {
118
112
if (ex ) {
@@ -125,4 +119,5 @@ protected void streamData(ResultSet rs) throws SQLException, IOException {
125
119
};
126
120
return lobRse ;
127
121
}
122
+
128
123
}
0 commit comments