Search in sources :

Example 1 with UpdateResponse

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

the class NetSuiteClientServiceTest method testUpdate.

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

Aggregations

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