英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论