Add more basic assertions for Local(Date|Time)
See original GitHub issueSummary
It would be nice if AbstractLocal(Date|Time)Assert
has basic assertions for field values of actual
.
LocalDate
-
hasYear
- 9dc086d82aa58a755f36cf88449b0ca74288bb63 -
hasMonth
/hasMonthValue
- 40c979c253571743af8d68f18921a061e10cfcec -
hasDayOfMonth
- 253194d00395e1568e1be752b0075c2033672f97
LocalTime
-
hasHour
- 8c54e417b697314e55170668bd96c236fa3c96d6 -
hasMinute
- ec1fcaefb767d0ed18a7e6ea48779c78635d1399 -
hasSecond
- 6a4e54cbad5198246ae41a21d8432c503b5c70ce -
hasNano
- b756459
LocalDateTime
-
hasYear
- 710177b -
hasMonth
/hasMonthValue
- d0c87895c2a052473e8c4a7800fa7fee0a20dccb -
hasDayOfMonth
- 710177b -
hasHour
- 7cbe45c42f0a31bc5993a8352cf5e0d4feda0fae -
hasMinute
- 02fa4a9ab -
hasSecond
- 99e4f652cecc6f4492a0aec7bcfc7e97518a032a -
hasNano
- 76012bb
Examples
final LocalDate actual = LocalDate.now();
assertThat(actual).hasYear(actual.getYear());
assertThat(actual).hasMonth(actual.getMonth());
assertThat(actual).hasMonthValue(actual.getMonthValue());
assertThat(actual).hasDayOfMonth(actual.getDayOfMonth());
final LocalTime actual = LocalTime.now();
assertThat(actual).hasHour(actual.getHour());
assertThat(actual).hasMinute(actual.getMinute());
assertThat(actual).hasSecond(actual.getSecond());
assertThat(actual).hasNano(actual.getNano());
Issue Analytics
- State:
- Created a year ago
- Comments:25 (25 by maintainers)
Top Results From Across the Web
Add more basic assertions for Local(Date|Time) #2541 - GitHub
Summary It would be nice if AbstractLocal(Date|Time)Assert has basic assertions for field values of actual.
Read more >Dates & Times - Fluent Assertions
A very extensive set of extension methods that allow you to more naturally specify the expected outcome of a TDD or BDD-style unit...
Read more >java - Compare Date objects with different levels of precision
Starting with version 3.7.0, AssertJ added an isCloseTo assertions, if you are using the Java 8 Date / Time API. LocalTime _07_10 =...
Read more >AssertJ's Java 8 Features - Baeldung
The LocalDateTime assertions work similarly to LocalDate's, but do not share the isToday method. Let's create an example LocalDateTime object:
Read more >AssertJ - fluent assertions java library - GitHub Pages
A Joda Time module to provide assertions for Joda Time types (DateTime, LocalDateTime). A Neo4J module to provide assertions for Neo4J types (Path,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jessicant this why @onacit has suggested having two assertions for month that matches the
LocalDate
APIUse
int
forhasMonthValue
andMonth
forhasMonth
.@onacit correct me if I’m wrong 😉
thanks @jessicant, this issue being big I split it into tasks so that multiple contributors can work on it, they should as you did indicate which assertions they want to work on. the integrated commit can be used as a reference for implementing the other assertions: 9dc086d82aa58a755f36cf88449b0ca74288bb63