### Question:
CamundaRestPollingServiceImpl implements PollingService { String formatDate(Date date) { String dateFormatPattern = camundaProperties.getDateFormatPattern(); SimpleDateFormat apiDateFormat = new SimpleDateFormat(dateFormatPattern); String sourceTimeZone = camundaProperties.getSourceTimeZone(); if (sourceTimeZone != null && !sourceTimeZone.isEmpty()) apiDateFormat.setTimeZone(TimeZone.getTimeZone(sourceTimeZone)); return apiDateFormat.format(date); } CamundaRestPollingServiceImpl(CamundaRestPollingProperties camundaProperties, RestTemplate restTemplate); @Override Iterable<ProcessInstanceEvent> pollFinishedProcessInstances(Date startedAfter, Date startedBefore,
                                                                       Date finishedAfter); @Override Iterable<ProcessInstanceEvent> pollUnfinishedProcessInstances(Date startedAfter, Date startedBefore); @Override Iterable<ActivityInstanceEvent> pollFinishedActivities(String processInstanceId, Date finishedAfter,
                                                                  Date finishedBefore); @Override Iterable<ActivityInstanceEvent> pollUnfinishedActivities(String processInstanceId, Date startedAfter,
                                                                    Date startedBefore); @Override Iterable<VariableUpdateEvent> pollCurrentVariables(String activityInstanceId); @Override Iterable<VariableUpdateEvent> pollVariableDetails(String activityInstanceId); @Override Iterable<ProcessDefinitionEvent> pollProcessDefinitions(final Date startTime,
                                                                   final Date endTime); @Override Iterable<CommentEvent> pollComments(final ActivityInstanceEvent activityInstanceEvent); @Override Iterable<IdentityLinkEvent> pollIdentityLinks(final ActivityInstanceEvent activityInstanceEvent);  }### Answer:
@SuppressWarnings({ "rawtypes", "unchecked" }) @Test void diffSourceTimeZone() throws ParseException { final String noTimeZonePattern = "yyyy-MM-dd'T'HH:mm:ss"; final String testDateStr = "2012-10-01T09:45:00"; final String simulatedLocalTimeZone = "GMT"; final long simulatedHoursDiff = 3; final String simulatedSourceTimeZone = "GMT+" + simulatedHoursDiff; DateFormat noTimeZoneDateFormat = new SimpleDateFormat(noTimeZonePattern); noTimeZoneDateFormat.setTimeZone(TimeZone.getTimeZone(simulatedLocalTimeZone)); Date localDate = noTimeZoneDateFormat.parse(testDateStr); CamundaRestPollingProperties prop = new CamundaRestPollingProperties(); prop.setSourceTimeZone(simulatedSourceTimeZone); CamundaRestPollingServiceImpl camundaRestPollingService = new CamundaRestPollingServiceImpl(prop, mockedRestTemplate); String sourceFormatedDateStr = camundaRestPollingService.formatDate(localDate); Date sourceDate = noTimeZoneDateFormat.parse(sourceFormatedDateStr); long diffInMillies = Math.abs(localDate.getTime() - sourceDate.getTime()); long diff = TimeUnit.HOURS.convert(diffInMillies, TimeUnit.MILLISECONDS); assertEquals(diff, simulatedHoursDiff); }