-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue 17: Include AM/PM indicator in times
- Loading branch information
Showing
9 changed files
with
145 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/test/java/org/exparity/hamcrest/date/core/format/DateFormatterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.exparity.hamcrest.date.core.format; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
import org.exparity.hamcrest.date.testutils.Dates; | ||
import org.hamcrest.Matchers; | ||
import org.testng.annotations.Test; | ||
|
||
/** | ||
* Unit test for the {@link DateFormatter} class | ||
* | ||
* @author Stewart Bissett | ||
*/ | ||
public class DateFormatterTest { | ||
|
||
@Test | ||
public void canDescribe() { | ||
String description = new DateFormatter().describe(Dates.AUG_04_2015_1159_AS_DATE); | ||
assertThat(description, Matchers.equalTo("Tue, 04 Aug 2015 11:59:00.000 AM")); | ||
} | ||
|
||
@Test | ||
public void canDescribeDate() { | ||
String description = new DateFormatter().describeDate(Dates.AUG_04_2015_1159_AS_DATE); | ||
assertThat(description, Matchers.equalTo("Tue, 04 Aug 2015")); | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
src/test/java/org/exparity/hamcrest/date/core/format/LocalDateFormatterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.exparity.hamcrest.date.core.format; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
import org.exparity.hamcrest.date.testutils.Dates; | ||
import org.hamcrest.Matchers; | ||
import org.testng.annotations.Test; | ||
|
||
/** | ||
* Unit test for the {@link LocalDateFormatter} class | ||
* | ||
* @author Stewart Bissett | ||
*/ | ||
public class LocalDateFormatterTest { | ||
|
||
@Test | ||
public void canDescribe() { | ||
String description = new LocalDateFormatter().describe(Dates.AUG_04_2015); | ||
assertThat(description, Matchers.equalTo("Tue, 04 Aug 2015")); | ||
} | ||
|
||
@Test | ||
public void canDescribeDate() { | ||
String description = new LocalDateFormatter().describeDate(Dates.AUG_04_2015); | ||
assertThat(description, Matchers.equalTo("Tue, 04 Aug 2015")); | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
src/test/java/org/exparity/hamcrest/date/core/format/LocalDateTimeFormatterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.exparity.hamcrest.date.core.format; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
import org.exparity.hamcrest.date.testutils.Dates; | ||
import org.hamcrest.Matchers; | ||
import org.testng.annotations.Test; | ||
|
||
/** | ||
* Unit test for the {@link LocalDateTimeFormatter} class | ||
* | ||
* @author Stewart Bissett | ||
*/ | ||
public class LocalDateTimeFormatterTest { | ||
|
||
@Test | ||
public void canDescribe() { | ||
String description = new LocalDateTimeFormatter().describe(Dates.AUG_04_2015_1159); | ||
assertThat(description, Matchers.equalTo("Tue, 04 Aug 2015 11:59:00.000 AM")); | ||
} | ||
|
||
@Test | ||
public void canDescribeDate() { | ||
String description = new LocalDateTimeFormatter().describeDate(Dates.AUG_04_2015_1159); | ||
assertThat(description, Matchers.equalTo("Tue, 04 Aug 2015")); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
src/test/java/org/exparity/hamcrest/date/core/format/LocalTimeFormatterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.exparity.hamcrest.date.core.format; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
import java.time.LocalTime; | ||
import java.time.temporal.ChronoUnit; | ||
|
||
import org.hamcrest.Matchers; | ||
import org.testng.annotations.Test; | ||
|
||
/** | ||
* Unit test for the {@link LocalTimeFormatter} class | ||
* | ||
* @author Stewart Bissett | ||
*/ | ||
public class LocalTimeFormatterTest { | ||
|
||
@Test | ||
public void canDescribe() { | ||
String description = new LocalTimeFormatter().describe(LocalTime.NOON.minus(1, ChronoUnit.SECONDS)); | ||
assertThat(description, Matchers.equalTo("11:59:59 AM")); | ||
} | ||
|
||
@Test(expectedExceptions = UnsupportedOperationException.class) | ||
public void canDescribeDate() { | ||
new LocalTimeFormatter().describeDate(LocalTime.NOON.minus(1, ChronoUnit.SECONDS)); | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
src/test/java/org/exparity/hamcrest/date/core/format/ZonedDateTimeFormatterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.exparity.hamcrest.date.core.format; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
import org.exparity.hamcrest.date.testutils.Dates; | ||
import org.hamcrest.Matchers; | ||
import org.testng.annotations.Test; | ||
|
||
/** | ||
* Unit test for the {@link ZonedDateTimeFormatter} class | ||
* | ||
* @author Stewart Bissett | ||
*/ | ||
public class ZonedDateTimeFormatterTest { | ||
|
||
@Test | ||
public void canDescribe() { | ||
String description = new ZonedDateTimeFormatter().describe(Dates.AUG_04_2015_11AM_UTC); | ||
assertThat(description, Matchers.equalTo("Tue, 04 Aug 2015 11:59:00.000 AM +0000")); | ||
} | ||
|
||
@Test | ||
public void canDescribeDate() { | ||
String description = new ZonedDateTimeFormatter().describeDate(Dates.AUG_04_2015_11AM_UTC); | ||
assertThat(description, Matchers.equalTo("Tue, 04 Aug 2015")); | ||
} | ||
|
||
} |