@Test public void testGetTimeZones() { final TimeZone timeZone0 = mock(TimeZone.class); final TimeZone timeZone1 = mock(TimeZone.class); final String[] ids = new String[]{"0", "1"}; when(timeZone0.getRawOffset()).thenReturn(0); when(timeZone1.getRawOffset()).thenReturn(3600000); doReturn(ids).when(service).getAvailableIds(); doReturn(timeZone0).when(service).getTimeZone("0"); doReturn(timeZone1).when(service).getTimeZone("1"); final List<DMNSimpleTimeZone> simpleTimeZones = service.getTimeZones(); assertEquals(2, simpleTimeZones.size()); assertEquals(0, simpleTimeZones.get(0).getOffset(), 0.01d); assertEquals(1, simpleTimeZones.get(1).getOffset(), 0.01d); assertEquals("+00:00", simpleTimeZones.get(0).getOffsetString()); assertEquals("+01:00", simpleTimeZones.get(1).getOffsetString()); }
@Override public List<DMNSimpleTimeZone> getTimeZones() { final String[] ids = getAvailableIds(); final ArrayList<DMNSimpleTimeZone> list = new ArrayList<>(ids.length); for (final String id : ids) { final TimeZone timeZone = getTimeZone(id); final DMNSimpleTimeZone simpleTimeZone = new DMNSimpleTimeZone(); simpleTimeZone.setId(id); final double offset = toHours(timeZone.getRawOffset()); simpleTimeZone.setOffset(offset); simpleTimeZone.setOffsetString(formatOffset(offset)); list.add(simpleTimeZone); } return list; }
TimeZoneServiceImpl implements TimeZoneService { @Override public List<DMNSimpleTimeZone> getTimeZones() { final String[] ids = getAvailableIds(); final ArrayList<DMNSimpleTimeZone> list = new ArrayList<>(ids.length); for (final String id : ids) { final TimeZone timeZone = getTimeZone(id); final DMNSimpleTimeZone simpleTimeZone = new DMNSimpleTimeZone(); simpleTimeZone.setId(id); final double offset = toHours(timeZone.getRawOffset()); simpleTimeZone.setOffset(offset); simpleTimeZone.setOffsetString(formatOffset(offset)); list.add(simpleTimeZone); } return list; } }
TimeZoneServiceImpl implements TimeZoneService { @Override public List<DMNSimpleTimeZone> getTimeZones() { final String[] ids = getAvailableIds(); final ArrayList<DMNSimpleTimeZone> list = new ArrayList<>(ids.length); for (final String id : ids) { final TimeZone timeZone = getTimeZone(id); final DMNSimpleTimeZone simpleTimeZone = new DMNSimpleTimeZone(); simpleTimeZone.setId(id); final double offset = toHours(timeZone.getRawOffset()); simpleTimeZone.setOffset(offset); simpleTimeZone.setOffsetString(formatOffset(offset)); list.add(simpleTimeZone); } return list; }  }
TimeZoneServiceImpl implements TimeZoneService { @Override public List<DMNSimpleTimeZone> getTimeZones() { final String[] ids = getAvailableIds(); final ArrayList<DMNSimpleTimeZone> list = new ArrayList<>(ids.length); for (final String id : ids) { final TimeZone timeZone = getTimeZone(id); final DMNSimpleTimeZone simpleTimeZone = new DMNSimpleTimeZone(); simpleTimeZone.setId(id); final double offset = toHours(timeZone.getRawOffset()); simpleTimeZone.setOffset(offset); simpleTimeZone.setOffsetString(formatOffset(offset)); list.add(simpleTimeZone); } return list; }  @Override List<DMNSimpleTimeZone> getTimeZones(); }
TimeZoneServiceImpl implements TimeZoneService { @Override public List<DMNSimpleTimeZone> getTimeZones() { final String[] ids = getAvailableIds(); final ArrayList<DMNSimpleTimeZone> list = new ArrayList<>(ids.length); for (final String id : ids) { final TimeZone timeZone = getTimeZone(id); final DMNSimpleTimeZone simpleTimeZone = new DMNSimpleTimeZone(); simpleTimeZone.setId(id); final double offset = toHours(timeZone.getRawOffset()); simpleTimeZone.setOffset(offset); simpleTimeZone.setOffsetString(formatOffset(offset)); list.add(simpleTimeZone); } return list; }  @Override List<DMNSimpleTimeZone> getTimeZones();  }