-
Notifications
You must be signed in to change notification settings - Fork 376
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
Date Matchers #6
Conversation
There were some old copyright notices hanging around in the code which I've stripped out. Any chance you could check out the code and see if you'd like to pull it into the main hamcrest branch. Thanks, |
I don't see any provision for dealing with time zones. If you are dealing with Calendars, you need to think about time zones. IsSameDayOfMonth is great until your times are 12:30am and 6:30am and your test succeeds when run on the East Coast and fails when run on the West Coast. I've been there and retrofitting these things is not pretty. One off-the-cuff possibility is to pass a TimeZone along as well, but you might come up with something better if you have some time to spend thinking about it. |
Hi, Why don't you name your method : hasSameHour, hasSameMinute, etc (instead of isSameHour, isSameMinute,...) |
Hi Proximator, I agree that the renamed methods would be better. The project is being developed under https://github.com/modularit/hamcrest-date and has moved on from this original pull request. I'm actively developing the hamcrest-date lib at the other location. |
Thanks for your reply. |
Hi Proximator, These methods have been deprecated in the latest version of the code. It has been replaced with isSameDatePart() to support any of the Calendar constants. The code is at https://github.com/modularit/hamcrest-date. The hamcrest-date library is also now on the maven central repos if you need to use it. If you'd like changes can I suggest to raise them on the https://github.com/modularit/hamcrest-date project. Thanks stewbis |
Ok, I will do it 👍 |
@louisth Timezones are system default unless supplied otherwise. Why would 12:30am and 6:30am US East Coast time be the same day, but 12:30am and 6:30am US West Coast time be different days? |
Hi This pull request seems to have been closed but these doesn't seem to be any sign of the date package in hamcrest-library. Will these date matchers be part of the standard hamcrest-library distribution going forward or must we get them from the modularit repository? Regards, |
It will be an add-on library. See the comment above (#6 (comment)) |
Hi,
I've added a suite of date matchers which add support for testing if the date is before, after, or within a time period. There are also matchers for testing if a date is the same hour, second, minute, year, etc.
I've added them to the matchers.xml and also setup unit tests, however they use the annotations so aren't invoked by your ant script but if you're happy with the code I can port these over to base off TestCase
When you get some time could you review the changes and consider them for inclusion.
Best Regards
Stewbis