fixes a test which fails if the local time zone was not EST as the output from the formatter would change the offset of the reproduced string value.

This commit is contained in:
Joseph Athman 2014-11-18 22:19:50 -06:00
parent 0cce1d21df
commit fb4246577d
1 changed files with 11 additions and 10 deletions

View File

@ -1,18 +1,19 @@
package ca.uhn.fhir.model.primitive; package ca.uhn.fhir.model.primitive;
import static org.junit.Assert.*; import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.parser.DataFormatException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
import org.apache.commons.lang3.time.FastDateFormat; import org.apache.commons.lang3.time.FastDateFormat;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum; import java.text.SimpleDateFormat;
import ca.uhn.fhir.parser.DataFormatException; import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
public class BaseDateTimeDtTest { public class BaseDateTimeDtTest {
private SimpleDateFormat myDateInstantParser; private SimpleDateFormat myDateInstantParser;
@ -39,7 +40,7 @@ public class BaseDateTimeDtTest {
Date instant = myDateInstantParser.parse("2001-02-03 13:01:02.555"); Date instant = myDateInstantParser.parse("2001-02-03 13:01:02.555");
for (FastDateFormat next : BaseDateTimeDt.getFormatters()) { for (FastDateFormat next : BaseDateTimeDt.getFormatters()) {
GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("EST")); Calendar cal = Calendar.getInstance();
cal.setTime(instant); cal.setTime(instant);
String value = next.format(cal); String value = next.format(cal);
ourLog.info("String: {}", value); ourLog.info("String: {}", value);