BAEL-5465: removed link from readme, reordered tests (#11977)

This commit is contained in:
etrandafir93 2022-03-25 17:09:52 +01:00 committed by GitHub
parent b541fce0a5
commit bcb342693c
2 changed files with 11 additions and 12 deletions

View File

@ -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)
- [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)
- [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)

View File

@ -13,6 +13,17 @@ import org.junit.Test;
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
public void givenCalendarDate_whenSubtractingFiveDays_dateIsChangedCorrectly() {
Calendar calendar = Calendar.getInstance();
@ -35,15 +46,4 @@ public class SubtractDaysFromDateUnitTest {
assertEquals(4, dateTime.getMonthOfYear());
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());
}
}