Skip to content

Temporal type not available on assertThat #3404

@xenoterracide

Description

@xenoterracide

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

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions