GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Support for `Assertions.byLessThan(Duration)` and `Assertions.within(Duration)` · Issue #3486 · assertj/assertj

Support for Assertions.byLessThan(Duration) and Assertions.within(Duration) #3486

New issue
Copy link
New issue
Copy link
Closed
✨ New Feature
Closed
Support for Assertions.byLessThan(Duration) and Assertions.within(Duration)#3486
✨ New Feature
Copy link
Labels
status: ideal for contributionAn issue that a contributor can help us with
Milestone
3.27.0

Description

@khmarbaise
khmarbaise
opened on May 22, 2024
Issue body actions

Feature summary

Enhance the byLessThan(..) and within to support the usage of Duration.

At the moment byLessThan(..) and within support the usage of a value combined with a TemporalUnit which looks like this:

assertThat(_07_10_20).isCloseTo(_07_11_45, byLessThan(1, ChronoUnit.MINUTES));
assertThat(_07_10_00).isCloseTo(_07_12_00, within(1, ChronoUnit.MINUTES));

Example

My suggestion is to enhance it in that way that you are able to use Duration instead of two different parameters like this:

assertThat(_07_10_20).isCloseTo(_07_11_45, byLessThan(Duration.ofMinutes(1)));
assertThat(_07_10_20).isCloseTo(_07_11_45, byLessThan(Duration.ofSeconds(45)));

or as example for within:

assertThat(_07_10_00).isCloseTo(_07_12_00, within(Duration.ofMinutes(1)));
Reacted by Joel Costigliola

Activity

  1. scordio
    added
    type: improvement
    status: ideal for contributionAn issue that a contributor can help us with
    on May 22, 2024
  2. scordio commented on May 22, 2024

    @scordio
    scordio
    on May 22, 2024
    Member
    More actions

    Indeed, it would be a nice addition!

  3. etrandafir93 commented on Jun 20, 2024

    @etrandafir93
    etrandafir93
    on Jun 20, 2024
    Contributor
    More actions

    @scordio - I guess we just need some simple static factory methods.

    I have added my changes and created this small PR.

    Reacted by Karl Heinz Marbaise
  4. joel-costigliola
    closed this as completedin a587528on Sep 25, 2024
  5. joel-costigliola
    added this to the 3.27.0 milestone on Sep 25, 2024
  6. scordio
    removed
    type: improvement
    on Oct 2, 2024
  7. wjbakker
    added a commit that references this issue on Nov 11, 2024

    Add support for isCloseTo within duration

    This issue will close once commit a587528 is merged into the 'master' branch.
    a587528
  8. scordio
    changed the title [-]Support for Duration in Assertions.byLessThan, Assertions.within[/-] [+]Support for `Assertions.byLessThan(Duration)` and `Assertions.within(Duration)`[/+] on Dec 14, 2024
  9. nosan
    added a commit that references this issue on Mar 4, 2025

    Add support for isCloseTo within duration

    This issue will close once commit f09cc3b is merged into the '3.x' branch.
    f09cc3b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: ideal for contributionAn issue that a contributor can help us with

    Type

    ✨ New Feature

    Projects

    No projects

      Milestone

      • 3.27.0

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.