Skip to content

Commit

Permalink
Add unit testcase for the cursor out parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
daneshk committed Feb 25, 2024
1 parent 0103466 commit 327451d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
* This class provides functionality for the `ProcedureCallResult` to iterate through the sql result sets.
*/
public class ProcedureCallResultUtils {
private ProcedureCallResultUtils() {
public ProcedureCallResultUtils() {

Check warning on line 55 in native/src/main/java/io/ballerina/stdlib/sql/utils/ProcedureCallResultUtils.java

View check run for this annotation

Codecov / codecov/patch

native/src/main/java/io/ballerina/stdlib/sql/utils/ProcedureCallResultUtils.java#L55

Added line #L55 was not covered by tests
}

public static Object getNextQueryResult(BObject procedureCallResult) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @since 1.2.0
*/
public class RecordIteratorUtils {
private RecordIteratorUtils() {
public RecordIteratorUtils() {

Check warning on line 40 in native/src/main/java/io/ballerina/stdlib/sql/utils/RecordIteratorUtils.java

View check run for this annotation

Codecov / codecov/patch

native/src/main/java/io/ballerina/stdlib/sql/utils/RecordIteratorUtils.java#L40

Added line #L40 was not covered by tests
}

public static Object nextResult(BObject recordIterator) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,14 @@ void getStructTest() {
BMap<BString, Object> map = (BMap<BString, Object>) obj;
assertEquals(map.get(fromString("value1")), false);
}

@Test
void getRefCursorTest() {
BObject object = TestUtils.getMockObject("REF_CURSOR");
object.addNativeData(Constants.ParameterObject.SQL_TYPE_NATIVE_DATA, 2012);
object.addNativeData(Constants.ParameterObject.VALUE_NATIVE_DATA, null);

assertNull(OutParameterProcessor.get(object, TestUtils.getBTypedesc(TestUtils.getStringStructRecord()),
DefaultResultParameterProcessor.getInstance()));
}
}

0 comments on commit 327451d

Please sign in to comment.