JAVA-617 Split or move core-java-datetime-java8 module

This commit is contained in:
mikr 2020-04-15 22:29:52 +02:00
parent 13ce413ed2
commit ddf9da34bf
11 changed files with 9 additions and 7 deletions

View File

@ -1,3 +1,5 @@
### Relevant Articles:
- [Generating Random Dates in Java](https://www.baeldung.com/java-random-dates)
- [Creating a LocalDate with Values in Java](https://www.baeldung.com/java-creating-localdate-with-values)
- [[<-- Prev]](/core-java-modules/core-java-datetime-java8-1)

View File

@ -11,31 +11,31 @@ public class LocalDateExampleUnitTest {
@Test
public void givenValues_whenUsingOfMethod_thenLocalDate() {
assertEquals("2020-01-08", date.getCustomDateOne(2020, 1, 8));
assertEquals("2020-01-08", date.getCustomDateOne(2020, 1, 8).toString());
}
@Test
public void givenValuesWithMonthEnum_whenUsingOfMethod_thenLocalDate() {
assertEquals("2020-01-08", date.getCustomDateTwo(2020, Month.JANUARY, 8));
assertEquals("2020-01-08", date.getCustomDateTwo(2020, Month.JANUARY, 8).toString());
}
@Test
public void givenValues_whenUsingEpochDay_thenLocalDate() {
assertEquals("2020-01-08", date.getDateFromEpochDay(18269));
assertEquals("2020-01-08", date.getDateFromEpochDay(18269).toString());
}
@Test
public void givenValues_whenUsingYearDay_thenLocalDate() {
assertEquals("2020-01-08", date.getDateFromYearAndDayOfYear(2020, 8));
assertEquals("2020-01-08", date.getDateFromYearAndDayOfYear(2020, 8).toString());
}
@Test
public void givenValues_whenUsingParse_thenLocalDate() {
assertEquals("2020-01-08", date.getDateFromString("2020-01-08"));
assertEquals("2020-01-08", date.getDateFromString("2020-01-08").toString());
}
@Test
public void givenValuesWithFormatter_whenUsingParse_thenLocalDate() {
assertEquals("2020-01-08", date.getDateFromStringAndFormatter("8-Jan-2020", "d-MMM-yyyy"));
assertEquals("2020-01-08", date.getDateFromStringAndFormatter("8-Jan-2020", "d-MMM-yyyy").toString());
}
}

View File

@ -13,4 +13,4 @@ This module contains articles about the Date and Time API introduced with Java 8
- [How to Get the Start and the End of a Day using Java](http://www.baeldung.com/java-day-start-end)
- [Set the Time Zone of a Date in Java](https://www.baeldung.com/java-set-date-time-zone)
- [Comparing Dates in Java](https://www.baeldung.com/java-comparing-dates)
- [Generating Random Dates in Java](https://www.baeldung.com/java-random-dates)
- [[Next -->]](/core-java-modules/core-java-datetime-java8-2)