use of com.netsuite.webservices.test.platform.messages.UpsertResponse in project components by Talend.
the class NetSuiteClientServiceTest method testUpsert.
@Test
public void testUpsert() throws Exception {
TypeDesc typeDesc = clientService.getMetaDataSource().getTypeInfo("PurchaseOrder");
PurchaseOrder record = new NsObjectComposer<PurchaseOrder>(clientService.getMetaDataSource(), typeDesc).composeObject();
UpsertResponse response = new UpsertResponse();
response.setWriteResponse(createSuccessWriteResponse());
when(port.upsert(notNull(UpsertRequest.class))).thenReturn(response);
clientService.upsert(record);
verify(port, times(1)).login(notNull(LoginRequest.class));
verify(port, times(1)).upsert(notNull(UpsertRequest.class));
NsWriteResponse writeResponse = clientService.upsert(null);
assertNull(writeResponse.getStatus());
assertNull(writeResponse.getRef());
}
Aggregations