Search in sources :

Example 1 with GetResponse

use of com.netsuite.webservices.v2014_2.platform.messages.GetResponse in project components by Talend.

the class NetSuiteMockTestBase method mockGetRequestResults.

protected <T extends Record> void mockGetRequestResults(final T record) throws Exception {
    final NetSuitePortType port = webServiceMockTestFixture.getPortMock();
    when(port.get(any(GetRequest.class))).then(new Answer<GetResponse>() {

        @Override
        public GetResponse answer(InvocationOnMock invocationOnMock) throws Throwable {
            GetResponse response = new GetResponse();
            ReadResponse readResponse = new ReadResponse();
            readResponse.setStatus(createSuccessStatus());
            readResponse.setRecord(record);
            response.setReadResponse(readResponse);
            return response;
        }
    });
}
Also used : NetSuitePortType(com.netsuite.webservices.v2014_2.platform.NetSuitePortType) ReadResponse(com.netsuite.webservices.v2014_2.platform.messages.ReadResponse) InvocationOnMock(org.mockito.invocation.InvocationOnMock) GetRequest(com.netsuite.webservices.v2014_2.platform.messages.GetRequest) GetResponse(com.netsuite.webservices.v2014_2.platform.messages.GetResponse)

Example 2 with GetResponse

use of com.netsuite.webservices.v2014_2.platform.messages.GetResponse in project components by Talend.

the class NetSuiteMockTestBase method mockGetRequestResults.

protected <T extends Record> void mockGetRequestResults(final T record) throws Exception {
    final NetSuitePortType port = webServiceMockTestFixture.getPortMock();
    when(port.get(any(GetRequest.class))).then(new Answer<GetResponse>() {

        @Override
        public GetResponse answer(InvocationOnMock invocationOnMock) throws Throwable {
            GetResponse response = new GetResponse();
            ReadResponse readResponse = new ReadResponse();
            if (record != null) {
                readResponse.setStatus(createSuccessStatus());
            } else {
                readResponse.setStatus(createNotFoundStatus());
            }
            readResponse.setRecord(record);
            response.setReadResponse(readResponse);
            return response;
        }
    });
}
Also used : NetSuitePortType(com.netsuite.webservices.v2016_2.platform.NetSuitePortType) ReadResponse(com.netsuite.webservices.v2016_2.platform.messages.ReadResponse) InvocationOnMock(org.mockito.invocation.InvocationOnMock) GetRequest(com.netsuite.webservices.v2016_2.platform.messages.GetRequest) GetResponse(com.netsuite.webservices.v2016_2.platform.messages.GetResponse)

Aggregations

InvocationOnMock (org.mockito.invocation.InvocationOnMock)2 NetSuitePortType (com.netsuite.webservices.v2014_2.platform.NetSuitePortType)1 GetRequest (com.netsuite.webservices.v2014_2.platform.messages.GetRequest)1 GetResponse (com.netsuite.webservices.v2014_2.platform.messages.GetResponse)1 ReadResponse (com.netsuite.webservices.v2014_2.platform.messages.ReadResponse)1 NetSuitePortType (com.netsuite.webservices.v2016_2.platform.NetSuitePortType)1 GetRequest (com.netsuite.webservices.v2016_2.platform.messages.GetRequest)1 GetResponse (com.netsuite.webservices.v2016_2.platform.messages.GetResponse)1 ReadResponse (com.netsuite.webservices.v2016_2.platform.messages.ReadResponse)1