package org.ambraproject.wombat.util;

import org.testng.annotations.Test;

import static org.testng.Assert.assertEquals;

public class CalendarUtilTest {

  @Test
  public void testFormatIso8601Date() {
    assertEquals(CalendarUtil.formatIso8601Date("2015-01-13T00:00:00Z", "yyyy-MM-dd", false), "2015-01-12");
    assertEquals(CalendarUtil.formatIso8601Date("2015-01-13T00:00:00Z", "yyyy-MM-dd", true), "2015-01-13");

    // Try a day when daylight savings time was in effect.
    assertEquals(CalendarUtil.formatIso8601Date("2015-08-07T00:00:00Z", "yyyy-MM-dd", false), "2015-08-06");
    assertEquals(CalendarUtil.formatIso8601Date("2015-08-07T00:00:00Z", "yyyy-MM-dd", true), "2015-08-07");
  }
}

@@ -197,16 +197,125 @@
 ate() %7B%0A
+    assertEquals(CalendarUtil.formatIso8601Date(%222015-01-12T23:59:00Z%22, %22yyyy-MM-dd%22, false), %222015-01-12%22);%0A
     asse
@@ -402,33 +402,33 @@
 lse), %222015-01-1
-2
+3
 %22);%0A    assertEq
@@ -583,16 +583,125 @@
 effect.%0A
+    assertEquals(CalendarUtil.formatIso8601Date(%222015-08-06T23:59:00Z%22, %22yyyy-MM-dd%22, false), %222015-08-06%22);%0A
     asse
@@ -788,33 +788,33 @@
 lse), %222015-08-0
-6
+7
 %22);%0A    assertEq

Fix CalendarUtilTest