Search in sources :

Example 1 with AddResponse

use of com.netsuite.webservices.test.platform.messages.AddResponse in project components by Talend.

the class NetSuiteClientServiceTest method testAdd.

@Test
public void testAdd() throws Exception {
    TypeDesc typeDesc = clientService.getMetaDataSource().getTypeInfo("PurchaseOrder");
    PurchaseOrder record = new NsObjectComposer<PurchaseOrder>(clientService.getMetaDataSource(), typeDesc).composeObject();
    AddResponse response = new AddResponse();
    response.setWriteResponse(createSuccessWriteResponse());
    when(port.add(notNull(AddRequest.class))).thenReturn(response);
    clientService.add(record);
    verify(port, times(1)).login(notNull(LoginRequest.class));
    verify(port, times(1)).add(notNull(AddRequest.class));
    NsWriteResponse writeResponse = clientService.add(null);
    assertNull(writeResponse.getStatus());
    assertNull(writeResponse.getRef());
}
Also used : AddRequest(com.netsuite.webservices.test.platform.messages.AddRequest) TypeDesc(org.talend.components.netsuite.client.model.TypeDesc) PurchaseOrder(com.netsuite.webservices.test.transactions.purchases.PurchaseOrder) LoginRequest(com.netsuite.webservices.test.platform.messages.LoginRequest) AddResponse(com.netsuite.webservices.test.platform.messages.AddResponse) Test(org.junit.Test)

Aggregations

AddRequest (com.netsuite.webservices.test.platform.messages.AddRequest)1 AddResponse (com.netsuite.webservices.test.platform.messages.AddResponse)1 LoginRequest (com.netsuite.webservices.test.platform.messages.LoginRequest)1 PurchaseOrder (com.netsuite.webservices.test.transactions.purchases.PurchaseOrder)1 Test (org.junit.Test)1 TypeDesc (org.talend.components.netsuite.client.model.TypeDesc)1