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