Lukas,

    There's definitely room for improving the documentation around the 
MockDataProvider... There are MANY cases where I would like to use the bind 
values to help determine the result sets and that is not documented 
anywhere other than playing with the API. I will try to write up some 
concise docs on using the bind values as well as the query matching to be 
added. Other than that, I imagine it would be ideal to just somehow pass an 
identifier somehow so that you can explicitly choose a mock result for each 
query... I'm not sure what that would look like or how it could be 
implemented; but I will think on it..

Cheers,

Deven

On Tuesday, June 24, 2014 11:13:57 AM UTC-4, Lukas Eder wrote:
>
> Hi,
>
> Yes, if you provide "null" to the MockResult, you will get a somewhat 
> invalid result with no columns from your statement.
>
> Do you think there is room for improvement in that area?
>
> Cheers,
> Lukas
>
>
> 2014-06-24 15:31 GMT+02:00 Deven Phillips <[email protected] 
> <javascript:>>:
>
>> OK, back to answer my own question!!!
>>
>> The problem was that I needed to create the empty Result object with no 
>> members:
>>
>> private class EmptyResultsDataProvider implements MockDataProvider {
>>  @Override
>> public MockResult[] execute(MockExecuteContext ctx) throws SQLException {
>>  MockResult[] mock = new MockResult[1];
>> Result<Record4<String>> result = create.newResult(...);
>>  mock[0] = new MockResult(0, result);
>> return mock;
>>  }
>> }
>>
>> On Tuesday, June 24, 2014 9:24:58 AM UTC-4, Deven Phillips wrote:
>>>
>>> I would like to know if someone could explain what I am doing wrong 
>>> here...
>>>
>>> I have created an implementation of MockDataProvider which always 
>>> returns an empty result set:
>>>
>>> private class EmptyResultsDataProvider implements MockDataProvider {
>>>  @Override
>>> public MockResult[] execute(MockExecuteContext ctx) throws SQLException {
>>>  MockResult[] mock = new MockResult[1];
>>> mock[0] = new MockResult(0, null);
>>>  return mock;
>>> }
>>>  }
>>>
>>> But, when I try to run a query using that MockDataProvider, I get a 
>>> NullPointerException instead of a null result from fetchOne()???
>>>
>>> I have another MockDataProvider that actually returns data for that same 
>>> query, and it runs fine.
>>>
>>> Any thoughts or suggestions?
>>>
>>> Thanks in advance!!
>>>
>>> Deven
>>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "jOOQ User Group" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to