omnata_sf.SnowflakeSchemaResponse mockResponse = new omnata_sf.SnowflakeSchemaResponse();
mockResponse.data = new omnata_sf.SnowflakeSchemaResponse.Data();
mockResponse.data.rowtype = new List<omnata_sf.SnowflakeSchemaResponse.Rowtype>();
omnata_sf.SnowflakeSchemaResponse.Rowtype firstColumn = new omnata_sf.SnowflakeSchemaResponse.Rowtype();
firstColumn.name = 'Column1';
firstColumn.type_Z = 'VARCHAR'; // This is the Snowflake column's native data type
mockResponse.data.rowtype.add(firstColumn);
omnata_sf.SnowflakeSchemaResponse.Rowtype secondColumn = new omnata_sf.SnowflakeSchemaResponse.Rowtype();
secondColumn.name = 'Column2';
secondColumn.type_Z = 'FIXED';
firstColumn.precision = 2;
mockResponse.data.rowtype.add(secondColumn);
omnata_sf.SnowflakeSchemaResponse.Rowtype thirdColumn = new omnata_sf.SnowflakeSchemaResponse.Rowtype();
thirdColumn.name = 'Column3';
thirdColumn.type_Z = 'BOOLEAN';
mockResponse.data.rowtype.add(thirdColumn);
omnata_sf.SnowflakeSchemaResponse.Rowtype fourthColumn = new omnata_sf.SnowflakeSchemaResponse.Rowtype();
fourthColumn.name = 'Column4';
fourthColumn.type_Z = 'TIMESTAMP_LTZ';
mockResponse.data.rowtype.add(fourthColumn);
// add row values, these are always just a 2D matrix of the raw values Snowflake returns
DateTime dt1 = DateTime.newInstanceGmt(2017,4,9,0,0,0);
DateTime dt2 = DateTime.newInstanceGmt(2019,10,9,5,30,15);
mockResponse.data.rowset = new List<List<String>>();
mockResponse.data.rowset.add(new List<String>{'AColumn1Value','123.45','0',(dt1.getTime()/1000)+''}); // Snowflake returns epoch seconds
mockResponse.data.rowset.add(new List<String>{'AnotherColumn1Value','456.78','1',(dt2.getTime()/1000)+''});
mockResponse.data.total=2;
// pass in the mock object, instead of a connection name
omnata_sf.SnowflakeConnection connection = new omnata_sf.SnowflakeConnection(mockResponse);
// execute a query to get your own response object back
omnata_sf.SnowflakeSchemaResponse response = connection.executeQuery('doesnt matter what goes here, not sent to Snowflake',null);
Integer totalRowsInt = response.data.total;
System.assertEquals(2,totalRowsInt);
List<List<String>> rowset = response.data.rowset;
List<omnata_sf.SnowflakeSchemaResponse.Rowtype> rowtypes = response.data.rowtype;
// Use this option to get a list of rows, with columns indexed by name
List<Map<String,Object>> allRowsWithNamedColumns = response.getAllRowsWithNamedColumns();
System.assertEquals('AColumn1Value',allRowsWithNamedColumns.get(0).get('Column1'));
System.assertEquals(123.45,allRowsWithNamedColumns.get(0).get('Column2'));
System.assertEquals(0,allRowsWithNamedColumns.get(0).get('Column3'));
System.assertEquals(dt1,allRowsWithNamedColumns.get(0).get('Column4'));
System.assertEquals('AnotherColumn1Value',allRowsWithNamedColumns.get(1).get('Column1'));
System.assertEquals(456.78,allRowsWithNamedColumns.get(1).get('Column2'));
System.assertEquals(1,allRowsWithNamedColumns.get(1).get('Column3'));
System.assertEquals(dt2,allRowsWithNamedColumns.get(1).get('Column4'));
System.debug('Completed successfully');