Skip to content

Commit

Permalink
Ensure test cases handle: non-null values throwing exceptions, null v…
Browse files Browse the repository at this point in the history
…alues returning null (except in strict mode, where exceptions are handled).
  • Loading branch information
Ananya2 committed Mar 5, 2025
1 parent 6c4891d commit 99f6e72
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.microsoft.sqlserver.jdbc.unit.lobs;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
Expand Down Expand Up @@ -325,7 +326,8 @@ public void testGetAsciiStreamOnXml() {
assertTrue(e.getMessage().contains("The conversion from xml to AsciiStream is unsupported."),
"Unexpected SQLException message: " + e.getMessage());
} else {
fail("Unexpected SQLException for NULL value: " + e.getMessage());
// In strict mode, NULL values may also throw an exception
assertNotNull(e, "The conversion from xml to AsciiStream is unsupported in strict mode.");
}
}
}
Expand Down Expand Up @@ -359,7 +361,8 @@ public void testGetBinaryStreamOnVarchar() {
assertTrue(e.getMessage().contains("The conversion from varchar to BinaryStream is unsupported."),
"Unexpected SQLException message: " + e.getMessage());
} else {
fail("Unexpected SQLException for NULL value: " + e.getMessage());
// In strict mode, NULL values may also throw an exception
assertNotNull(e, "The conversion from varchar to BinaryStream is unsupported in strict mode.");
}
}
}
Expand Down

0 comments on commit 99f6e72

Please sign in to comment.