Comments (2)
oh, I wrote this instead
switch (now) {
case Instant instant -> {
assertThat(instant).isCloseTo(Instant.now(), within(1, ChronoUnit.SECONDS));
}
case ZonedDateTime zonedDateTime -> {
assertThat(zonedDateTime).isCloseTo(ZonedDateTime.now(), within(1, ChronoUnit.SECONDS));
}
case OffsetDateTime offsetDateTime -> {
assertThat(offsetDateTime).isCloseTo(OffsetDateTime.now(), within(1, ChronoUnit.SECONDS));
}
default -> throw new IllegalStateException("Unexpected value: " + now);
}
I suspect? that isCloseTo
could always take an instant, although that's not true here. I could be wrong, I have played with temporal enough right now to be certain of that.
from assertj.
Indeed, we don't have a TemporalAssert
class while we already have AbstractTemporalAssert
. It's fairly easy to add one (I'm already on it).
from assertj.
Related Issues (20)
- Add an unwrap method to the API to get actual value HOT 3
- Unable to construct iterable assertions across a specific type easily HOT 7
- Ambiguous `assertThat` for `Temporal` instance implementing `Comparable` HOT 3
- 3.26 - Ambiguous assertThat with Temporal implementation HOT 1
- Extra variant for doesNotMatch
- Add an annotation Class navigation method
- Recursive Comparison With Ignored Fields Fails On Equal Collections HOT 4
- hasFieldOrPropertyWithValue accepting arrays
- reference to assertThat is ambiguous when asserting a `java.time.Year` HOT 1
- JPMS assertions HOT 2
- Do we have any way to describe the expected value? HOT 1
- Consider `ClassBasedNavigableIterableAssert` and `ClassBasedNavigableListAssert` for deprecation
- Add assertion methods for floating point and integer format of `BigDecimal` HOT 7
- comparingOnlyFields get data of all fields HOT 7
- NPE when usingRecursiveAssertion with field with anonymous Type HOT 1
- AllOf should report which condition failed HOT 2
- usingRecursiveComparison returns false positive when java record has a boolean method with certain naming pattern HOT 2
- IntrospectionError: Unable to find property 'key' in java.util.KeyValueHolder HOT 1
- expose strictTypeChecking via ConfigurationProvider HOT 3
- `inBinary` not exposed for `String` assertions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from assertj.