如何断言当前日期?

huangapple go评论133阅读模式
英文:

How to assert with current date?

问题

尝试断言一个对象,该对象需要等于在测试运行的日期上的本地日期。

我有以下代码:

import java.util.Date;

public class YourClassName {

    float validateMetDate = S55.jsonPath().getFloat("details.ref");
    Assert.assertEquals(validateMetDate, crDate.getDate());

}

上面的库我尝试使用似乎只适用于一周中的某一天,或者我漏掉了什么。

英文:

Trying to assert an object and that object needs to be equal to the local date on whichever date the test is run.

I have the following code:

import java.util.Date; 

public class {


    float validateMetDate = S55.jsonPath().getFloat("details.ref"); 
    Assert.assertEquals(validateMetDate, crDate.getDate()); 

}

The library above I am trying to use only works with day of the week looks like or I am missing something.

答案1

得分: 0

LocalDate.now 对我有用。感谢大家的帮助。

英文:

LocalDate.now worked for me. Thanks all for the help.

huangapple
  • 本文由 发表于 2023年3月7日 12:11:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/75657974.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定