Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests | Add tests for SQLServerConnection to improve code coverage #1047

Merged
merged 15 commits into from
May 11, 2019
Merged
2 changes: 1 addition & 1 deletion src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -3025,7 +3025,7 @@ void setDataLoggable(boolean value) {
dataIsLoggable = value;
}

SharedTimer getSharedTimer() {
SharedTimer getSharedTimer() throws SQLServerException {
return con.getSharedTimer();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,13 @@ public class SQLServerConnection implements ISQLServerConnection, java.io.Serial
* Return an existing cached SharedTimer associated with this Connection or create a new one.
*
* The SharedTimer will be released when the Connection is closed.
*
* @throws SQLServerException
*/
SharedTimer getSharedTimer() {
SharedTimer getSharedTimer() throws SQLServerException {
if (state == State.Closed) {
throw new IllegalStateException(SQLServerException.getErrString("R_connectionIsClosed"));
SQLServerException.makeFromDriverError(null, null, SQLServerException.getErrString("R_connectionIsClosed"),
null, false);
}
if (null == sharedTimer) {
this.sharedTimer = SharedTimer.getTimer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,9 @@ public final void setLargeMaxRows(long max) throws SQLServerException {
// SQL server only supports integer limits for setting max rows.
// If <max> is bigger than integer limits then throw an exception, otherwise call setMaxRows(int)
if (max > Integer.MAX_VALUE) {
throw new UnsupportedOperationException(SQLServerException.getErrString("R_invalidMaxRows"));
MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_invalidMaxRows"));
Object[] msgArgs = {max};
SQLServerException.makeFromDriverError(connection, this, form.format(msgArgs), null, true);
}
setMaxRows((int) max);
loggerExternal.exiting(getClassNameLogging(), "setLargeMaxRows");
Expand Down
Loading