@@ -0,0 +1,2683 @@
+//////////////////////////////////////////////////////////////////////////////%0A// %0A//                    Copyright 2019, Cornutum Project%0A//                             www.cornutum.org%0A//%0A//////////////////////////////////////////////////////////////////////////////%0A%0Apackage org.cornutum.tcases.openapi;%0A%0Aimport org.junit.Test;%0Aimport static org.hamcrest.MatcherAssert.*;%0Aimport static org.hamcrest.Matchers.*;%0A%0Aimport java.util.Calendar;%0Aimport java.util.Date;%0Aimport java.util.TimeZone;%0Aimport static java.util.Calendar.*;%0A%0A/**%0A * Runs tests for %7B@link FormattedString%7D methods.%0A */%0Apublic class FormattedStringTest%0A  %7B%0A  @Test%0A  public void whenFormatDate()%0A    %7B%0A    // Given...%0A    Date date =%0A      new Calendar.Builder()%0A      .setDate( 2019, 0, 1)%0A      .build()%0A      .getTime();%0A    %0A    // When...%0A    FormattedString formatted = FormattedString.of( %22date%22, date);%0A    %0A    // Then...%0A    assertThat( %22Date string%22, formatted.toString(), is( %222019-01-01%22));%0A    %7D%0A  %0A  @Test%0A  public void whenFormatDateTime()%0A    %7B%0A    // Given...%0A    Calendar calendar =%0A      new Calendar.Builder()%0A      .setDate( 2019, 7, 9)%0A      .setTimeOfDay( 23, 59, 59, 876)%0A      .setTimeZone( TimeZone.getTimeZone( %22GMT%22))%0A      .build();%0A%0A    Date date = calendar.getTime();%0A    int localZoneOffset = TimeZone.getDefault().getOffset( System.currentTimeMillis()) / 60000;%0A      %0A    // When...%0A    FormattedString formatted = FormattedString.of( %22date-time%22, date);%0A    %0A    // Then...%0A    assertThat( %22Date string%22, formatted.toString(), is( toDateTimeString( calendar, localZoneOffset)));%0A    %7D%0A  %0A  @Test%0A  public void whenFormatByte()%0A    %7B%0A    // Given...%0A    byte%5B%5D bytes = %22Hello, world%22.getBytes();%0A    %0A    // When...%0A    FormattedString formatted = FormattedString.of( %22byte%22, bytes);%0A    %0A    // Then...%0A    assertThat( %22Bytes%22, formatted.toString(), is( %22SGVsbG8sIHdvcmxk%22));%0A    %7D%0A%0A  /**%0A   * Returns the expected string representation of the given time value, using the given local time zone offset.%0A   */%0A  private String toDateTimeString( Calendar calendar, int localZoneOffset)%0A    %7B%0A    int zonedHrMin = 60 * calendar.get( HOUR_OF_DAY) + calendar.get( MINUTE) + localZoneOffset;%0A    int zonedHr = zonedHrMin / 60;%0A    int zonedMin = zonedHrMin %25 60;%0A%0A    return%0A      String.format(%0A        %22%25s-%2502d-%2502dT%2502d:%2502d:%2502d.%25s%25s%2502d:%2502d%22,%0A        calendar.get( YEAR),%0A        calendar.get( MONTH) + 1,%0A        calendar.get( DAY_OF_MONTH),%0A        zonedHr,%0A        zonedMin,%0A        calendar.get( SECOND),%0A        calendar.get( MILLISECOND),%0A        localZoneOffset %3E= 0? %22+%22 : %22-%22,%0A        Math.abs( localZoneOffset / 60),%0A        Math.abs( localZoneOffset %25 60));%0A%0A    %7D%0A%0A  %7D%0A

Add FormattedStringTest