void methodA(){ }该MongoTemplate是在作为Spring boot运行应用程序时从配置文件中读取的。这是我的配置:public class MyConfig { public MongoTemplatemongoTemplate(){MongoTemplate mongo = new MongoTemplate();
when(mongoTemplate.findAndModify(any(Query.class), any(Update.class), any(FindAndModifyOptions.class)IntelliJ中的错误是Task cannot be returned by toStringPlease refer to Mockito FAQ on limitations of concurrency testing.
我使用JUnit来测试访问Postgres数据库的存储库。
我所有的测试数据都是手动设置的,因此我确切地知道了我期望得到的结果值。不过,我在测试使用current_timestamp的语句时遇到了麻烦,比如select * from phone_number where current_timestamp <= expires;我可以停止使用current_timestamp,并在我的所有语句中使用一个额外的时间戳参数,这些语句在正常使用时(在Java中)将类似于System.currentTime