1
日期作为futher问题是:Fake system clock on certain date确定Maven的轮廓
是否有可能设置Maven的配置文件确定的日期?毕竟,我使用测试配置文件来确定测试数据库的使用情况。
日期作为futher问题是:Fake system clock on certain date确定Maven的轮廓
是否有可能设置Maven的配置文件确定的日期?毕竟,我使用测试配置文件来确定测试数据库的使用情况。
在Maven的配置文件,您可以在一个日期 - 时间通过神火传递的系统属性:
...
<profile>
...
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<testDateTime>2013-01-01T00:00:00.000Z</testDateTime>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
...
,然后用它在你的测试,像这样:
final String dateTime = System.getProperty("testDateTime");
// parse date-time etc...
这是否帮帮我?
假设你也可以设置测试日期,那太棒了! – mjgirl 2013-03-06 06:33:29