ISO8601PartialDateTimeParser { public static Optional<PartialDateTime> parse(String text) { if ( text == null ) return Optional.empty(); LazyFunctionStream<String,Optional<PartialDateTime>> lazyFunctionStream = new LazyFunctionStream<>( text ); return lazyFunctionStream .of( ISO8601PartialLocalDateParser::parse, ISO8601PartialLocalDateTimeParser::parse, ISO8601PartialZonedDateTimeParser::parse, ISO8601PartialLegacyDateTimeParser::parse) .map( Supplier::get ) .filter( Optional::isPresent ) .map( Optional::get ) .findFirst(); }  static Optional<PartialDateTime> parse(String text);  }
@Test public void testWithYearMonthDay() throws Exception { assertEquals( "Optional[2011-12-03T10:15:30Z]", ISO8601PartialDateTimeParser.parse( "2011-12-03T10:15:30Z" ).toString() ); }
@Test public void testParseStandardWithZone() throws Exception { assertEquals( "Optional[2011-12-03T10:15:30Z]", ISO8601PartialDateTimeParser.parse( "2011-12-03T10:15:30Z" ).toString() ); }
@Test public void testParseStandardWithUTCZone() throws Exception { assertEquals( "Optional[2011-12-03T10:15:30Z]", ISO8601PartialDateTimeParser.parse( "2011-12-03T10:15:30UTC" ).toString() ); }
@Test public void testParseStandardWithoutZone() throws Exception { assertEquals( "Optional[2011-12-03T10:15:30]", ISO8601PartialDateTimeParser.parse( "2011-12-03T10:15:30" ).toString() ); }
@Test public void testYearMonthDay() throws Exception { assertEquals( "Optional[2011-12-03]", ISO8601PartialDateTimeParser.parse( "2011-12-03" ).toString() ); }
@Test public void testParseStandardWithoutTimeButWithZone() throws Exception { assertEquals( "Optional[2011-12-03]", ISO8601PartialDateTimeParser.parse( "2011-12-03Z" ).toString() ); }
@Test public void testParseStandardWithMillisAndZone() throws Exception { assertEquals( "Optional[2011-12-03T01:01:01.001Z]", ISO8601PartialDateTimeParser.parse( "2011-12-03T01:01:01.001Z" ).toString() ); assertEquals( "Optional[2011-12-03T01:01:01.001+01:00]", ISO8601PartialDateTimeParser.parse( "2011-12-03T01:01:01.001+01:00" ).toString() ); }
@Test public void testParseStandardWithMillis() throws Exception { assertEquals( "Optional[2011-12-03T01:01:01.001]", ISO8601PartialDateTimeParser.parse( "2011-12-03T01:01:01.001" ).toString() ); }
@Test public void testParseWithDateTimeHoursMinutes() throws Exception { assertEquals( "Optional[2011-12-03T01:01]", ISO8601PartialDateTimeParser.parse( "2011-12-03T01:01" ).toString() ); }