BAEL-5465: removed link from readme, reordered tests (#11977)
This commit is contained in:
parent
b541fce0a5
commit
bcb342693c
@ -11,5 +11,4 @@ This module contains articles about date operations in Java.
|
|||||||
- [How to determine day of week by passing specific date in Java?](https://www.baeldung.com/java-get-day-of-week)
|
- [How to determine day of week by passing specific date in Java?](https://www.baeldung.com/java-get-day-of-week)
|
||||||
- [Finding Leap Years in Java](https://www.baeldung.com/java-leap-year)
|
- [Finding Leap Years in Java](https://www.baeldung.com/java-leap-year)
|
||||||
- [Getting the Week Number From Any Date](https://www.baeldung.com/java-get-week-number)
|
- [Getting the Week Number From Any Date](https://www.baeldung.com/java-get-week-number)
|
||||||
- [Subtract Days from a Date in Java](https://www.baeldung.com/java-subtract-days-from-a-date)
|
|
||||||
- [[<-- Prev]](/core-java-modules/core-java-date-operations-1)
|
- [[<-- Prev]](/core-java-modules/core-java-date-operations-1)
|
||||||
|
@ -13,6 +13,17 @@ import org.junit.Test;
|
|||||||
|
|
||||||
public class SubtractDaysFromDateUnitTest {
|
public class SubtractDaysFromDateUnitTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenLocalDateTime_whenSubtractingFiveDays_dateIsChangedCorrectly() {
|
||||||
|
LocalDate localDateTime = LocalDate.of(2022, 4, 20);
|
||||||
|
|
||||||
|
localDateTime = localDateTime.minusDays(5);
|
||||||
|
|
||||||
|
assertEquals(15, localDateTime.getDayOfMonth());
|
||||||
|
assertEquals(4, localDateTime.getMonthValue());
|
||||||
|
assertEquals(2022, localDateTime.getYear());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenCalendarDate_whenSubtractingFiveDays_dateIsChangedCorrectly() {
|
public void givenCalendarDate_whenSubtractingFiveDays_dateIsChangedCorrectly() {
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
@ -35,15 +46,4 @@ public class SubtractDaysFromDateUnitTest {
|
|||||||
assertEquals(4, dateTime.getMonthOfYear());
|
assertEquals(4, dateTime.getMonthOfYear());
|
||||||
assertEquals(2022, dateTime.getYear());
|
assertEquals(2022, dateTime.getYear());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void givenLocalDateTime_whenSubtractingFiveDays_dateIsChangedCorrectly() {
|
|
||||||
LocalDate localDateTime = LocalDate.of(2022, 4, 20);
|
|
||||||
|
|
||||||
localDateTime = localDateTime.minusDays(5);
|
|
||||||
|
|
||||||
assertEquals(15, localDateTime.getDayOfMonth());
|
|
||||||
assertEquals(4, localDateTime.getMonthValue());
|
|
||||||
assertEquals(2022, localDateTime.getYear());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user