2013-03-05 24 views

回答

0

在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... 

这是否帮帮我?

+0

假设你也可以设置测试日期,那太棒了! – mjgirl 2013-03-06 06:33:29