Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added unit tests for DateUtils class #284

Open
wants to merge 4 commits into
base: upgrade-jdk11
Choose a base branch
from

Conversation

TunrayoIlawole
Copy link

@TunrayoIlawole TunrayoIlawole commented Oct 14, 2024

This PR addresses issues #507 and #510 by improving the test coverage of the DateUtils class

What was done

Added tests for the tryParseDuration method, testing for different valid and invalid duration inputs and making sure each input string returns the correct integer according to the respective unit.

Note: As a result of the slight delay in milliseconds in returning the output, the tests make assertions omitting the milliseconds

Screenshot 2024-10-14 at 15 57 38

@Test
public void testNowInput() {
TimeZone tz = TimeZone.getTimeZone(TimeZone.getAvailableIDs()[0]);
DateUtils util = new DateUtils(Locale.US, tz);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can move the DateUtils setup into a @Before method since it's used in all tests.

@TunrayoIlawole
Copy link
Author

Feedback noted @Lamouresparus . I have made the updates. Please let me know what you think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants