You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Test requiring incorrect result if running between The 01 January untill end of February each year.
It has hardcoded line adding 2 months of age every begining of the year:
at this line ( int expected = LocalDate.now().getYear() - 2000;)
@TestvoidtestCalculateAge_withEdgeCases() {
// Edge case: Leap yearStringdate = "2000-02-29";
intexpected = LocalDate.now().getYear() - 2000;
assertThat(ageFinder.calculateAge(date))
.withFailMessage("Expected age to be %d but got %d", expected, ageFinder.calculateAge(date))
.isEqualTo(expected);
// Edge case: Minimum valid dateStringminDate = "0001-01-01";
intminExpected = LocalDate.now().getYear() - 1;
assertThat(ageFinder.calculateAge(minDate))
.withFailMessage("Expected age to be %d but got %d", minExpected, ageFinder.calculateAge(minDate))
.isEqualTo(minExpected);
}
Users
Every student running Java-Piscine between above mentioned dates (01 Jan - 28 Feb) each year.
For a present moment test is ensuring person with DOB 2000-02-29 is 25 yo.
Severity
Choose the severity label (⚠️ critical).
Type
Choose the label (⚙️ functionality)
To Reproduce
Run the test within those mentioned dates
Workarounds
Hardcode is the only way to pass it for a moment.
Expected behavior
Test should require actual age instead of overaged.
Attachments
Desktop (please complete the following information):
Ubuntu 24.04.1 LTS
Smartphone (please complete the following information):
NA
Additional context
The text was updated successfully, but these errors were encountered:
liogedz
changed the title
[BUG] Java-Piscine / AgeFinder subject / Test required wrong result
[BUG] Java-Piscine / AgeFinder subject / Test is requiring wrong result
Jan 17, 2025
Describe the bug
Test requiring incorrect result if running between The 01 January untill end of February each year.
It has hardcoded line adding 2 months of age every begining of the year:
at this line ( int expected = LocalDate.now().getYear() - 2000;)
Users
Every student running Java-Piscine between above mentioned dates (01 Jan - 28 Feb) each year.
For a present moment test is ensuring person with DOB 2000-02-29 is 25 yo.
Severity⚠️ critical).
Choose the severity label (
Type
Choose the label (⚙️ functionality)
To Reproduce
Run the test within those mentioned dates
Workarounds
Hardcode is the only way to pass it for a moment.
Expected behavior
Test should require actual age instead of overaged.
Attachments
Desktop (please complete the following information):
Ubuntu 24.04.1 LTS
Smartphone (please complete the following information):
NA
Additional context
The text was updated successfully, but these errors were encountered: