Commit 1dd487ac authored by R.W.Majeed's avatar R.W.Majeed

test case for parsing timestamps without separators

parent 5eebe91b
......@@ -15,7 +15,6 @@ import org.junit.Assert;
import static org.junit.Assert.*;
import org.junit.Test;
import de.sekmi.histream.xml.DateTimeAccuracyAdapter;
public class TestDateTimeAccuracy {
......@@ -29,6 +28,16 @@ public class TestDateTimeAccuracy {
Assert.assertEquals(2, ac.get(ChronoField.MONTH_OF_YEAR));
Assert.assertEquals(2003, ac.get(ChronoField.YEAR));
}
@Test
public void testParseTimestampWithoutSeparators(){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("uuuuMMddHHmm");
String text = "201705190800";
DateTimeAccuracy a = DateTimeAccuracy.parse(formatter, text, ZoneOffset.UTC);
Assert.assertEquals(ChronoUnit.MINUTES,a.getAccuracy());
TemporalAccessor ac = a.toInstantMin().atOffset(ZoneOffset.UTC);
Assert.assertEquals(5, ac.get(ChronoField.MONTH_OF_YEAR));
Assert.assertEquals(2017, ac.get(ChronoField.YEAR));
}
@Test
public void verifyZoneOffset(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment