SyncFolderItemsResponseType syncItemsResponse = mock(SyncFolderItemsResponseType.class);
ArrayOfResponseMessagesType arrayOfResponseMessages = mock(ArrayOfResponseMessagesType.class);
SyncFolderItemsResponseMessageType syncFolderItemsResponseMessage =
mock(SyncFolderItemsResponseMessageType.class);
SyncFolderItemsChangesType syncFolderItemsChanges = mock(SyncFolderItemsChangesType.class);
when(getService().syncFolderItems(likeThis(syncItems), eq(getDefaultFolder().getUser())))
.thenReturn(syncItemsResponse);
when(syncItemsResponse.getResponseMessages()).thenReturn(arrayOfResponseMessages);
when(arrayOfResponseMessages.getSyncFolderItemsResponseMessageArray())
.thenReturn(new SyncFolderItemsResponseMessageType[]{syncFolderItemsResponseMessage});
when(syncFolderItemsResponseMessage.getResponseCode()).thenReturn(ResponseCodeType.NO_ERROR);
when(syncFolderItemsResponseMessage.isSetIncludesLastItemInRange()).thenReturn(true);
when(syncFolderItemsResponseMessage.getIncludesLastItemInRange()).thenReturn(false);
when(syncFolderItemsResponseMessage.isSetSyncState()).thenReturn(false);
when(syncFolderItemsResponseMessage.isSetChanges()).thenReturn(true);
when(syncFolderItemsResponseMessage.getChanges()).thenReturn(syncFolderItemsChanges);
SyncFolderItemsCreateOrUpdateType[] creates = createSyncFolderItemsCreateArray(ids);
when(syncFolderItemsChanges.getCreateArray()).thenReturn(creates);
SyncFolderItemsResult result =
SyncFolderItemsHelper.syncFolderItems(getService(), getDefaultConfig(), getDefaultFolder());
Vector<String> expected = new Vector<String>(1);
expected.add("onlyId");
assertEquals(expected, result.getIds());