-
-
Notifications
You must be signed in to change notification settings - Fork 766
Closed
Milestone
Description
Describe the bug
A clear and concise description of what the bug is.
- assertj core version: org.assertj:assertj-core:3.25.3
- java version: 21.0.2
- test framework version: org.junit:junit-bom:5.10.2
- os (if relevant):
Test case reproducing the bug
Add a test case showing the bug that we can run
@ParameterizedTest
@ArgumentsSource(TimeClassProvider.class)
void timeAvailableInTransaction(Class<? extends Temporal> timeClass) {
Temporal now = context.getBean(timeClass);
assertThat(now).isCloseTo(Instant.now(), within(1, ChronoUnit.SECONDS))
}
static class TimeClassProvider implements ArgumentsProvider {
@Override
public Stream<? extends Arguments> provideArguments(ExtensionContext context) {
return Stream.of(
Arguments.of(Instant.class),
Arguments.of(ZonedDateTime.class),
Arguments.of(OffsetDateTime.class)
);
}
}note: context is a Spring BeanFactory with signature, obviously if you want real runtime you could just pass instances though...
<T> T getBean(Class<T> requiredType) throws BeansException;Metadata
Metadata
Assignees
Labels
No labels