#639 Mock response QUERY_MATCH test not working correctly

v1.0 (example)
open
nobody
general (369)
5
2015-02-16
2012-09-17
nicki
No

Version: Latest 4.5.1 source

There appears to be a small bug on line 379 of WsdlMockOperation.java (method getLastMockResult)

The current line is:
if( result == null || result.getTimestamp() > mockResult.getTimestamp() )

I believe it should be:
if( result == null || result.getTimestamp() < mockResult.getTimestamp() )

so that a later mockresult will replace an older one, and not the other way around. The name of the method is getLastMockResult so I believe it should return the last result i.e. the one with the biggest timestamp?

Regards,
Nicki

Discussion

  • Richard Walker
    Richard Walker
    2013-10-14

    I have the same problem, getLastMockResult() returns the first result, not the last.
    Any chance to get this fixed soon?
    Is there a workaround?

     
  • Adam Lipiński
    Adam Lipiński
    2015-02-16

    My workaround feel free to use it:

    com.eviware.soapui.impl.wsdl.mock.WsdlMockResult lastResult = null;
    for(com.eviware.soapui.impl.wsdl.mock.WsdlMockResponse response: mockOperation.getMockResponses()){
    com.eviware.soapui.impl.wsdl.mock.WsdlMockResult mockResult = response.getMockResult();
    if(mockResult != null){
    if(lastResult == null || lastResult.getTimestamp() < mockResult.getTimestamp()){
    lastResult = mockResult;
    }
    }
    }
    log.info "RESULT: " + lastResult;