@Test public void testGetDeleted() throws Exception { SalesforceConnector connector = spy(new SalesforceConnector()); PartnerConnection partnerConnection = Mockito.mock(PartnerConnection.class); connector.setConnection(partnerConnection); BulkConnection bulkConnection = Mockito.mock(BulkConnection.class); connector.setBulkConnection(bulkConnection); GetServerTimestampResult getServerTimestampResult = Mockito.mock(GetServerTimestampResult.class); when(partnerConnection.getServerTimestamp()).thenReturn(getServerTimestampResult); when(getServerTimestampResult.getTimestamp()).thenReturn(Calendar.getInstance()); connector.getDeleted("Account", 30); verify(partnerConnection, atLeastOnce()) .getDeleted(eq("Account"), any(Calendar.class), any(Calendar.class)); }
private void setServerTime(PartnerConnection connection, int hourOfDay, int minute) throws com.sforce.ws.ConnectionException { GetServerTimestampResult getServerTimetampResult = Mockito.mock(GetServerTimestampResult.class); when(connection.getServerTimestamp()).thenReturn(getServerTimetampResult); when(getServerTimetampResult.getTimestamp()).thenReturn(createCalendar(hourOfDay, minute)); }