Make tests use UTC for dates.
This commit is contained in:
parent
652b87918d
commit
cb7f29e1de
12
pom.xml
12
pom.xml
|
@ -193,7 +193,17 @@
|
|||
<version>1.9.5</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.docker-java</groupId>
|
||||
<artifactId>docker-java</artifactId>
|
||||
<version>0.9.1-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jayway.restassured</groupId>
|
||||
<artifactId>rest-assured</artifactId>
|
||||
<version>2.3.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.hpcloud.mon.infrastructure.persistence.influxdb.AlarmStateHistoryInfl
|
|||
|
||||
import org.influxdb.InfluxDB;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
@ -48,10 +49,11 @@ public class AlarmStateHistoryInfluxDbRepositoryImplTest {
|
|||
}
|
||||
|
||||
public void buildTimePartTest() {
|
||||
String er = " and time > 1388559600s and time < 1388559601s";
|
||||
String er = " and time > 1388534400s and time < 1388534401s";
|
||||
String r =
|
||||
this.alarmStateHistoryInfluxDBRepository.buildTimePart(new DateTime(2014, 01, 01, 0, 0, 0),
|
||||
new DateTime(2014, 01, 01, 0, 0, 1));
|
||||
this.alarmStateHistoryInfluxDBRepository.buildTimePart(new DateTime(2014, 01, 01, 0, 0,
|
||||
0, DateTimeZone.UTC),
|
||||
new DateTime(2014, 01, 01, 0, 0, 1, DateTimeZone.UTC));
|
||||
assert (er.equals(r));
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test
|
||||
|
@ -29,9 +30,9 @@ public class UtilsTest {
|
|||
}
|
||||
|
||||
public void whereClauseBuilderBuildTimePartTest() {
|
||||
String expectedResult = " and time > 1388563261s and time < 1388563262s";
|
||||
DateTime startTime = new DateTime(2014, 01, 01, 01, 01, 01);
|
||||
DateTime endTime = new DateTime(2014, 01, 01, 01, 01, 02);
|
||||
String expectedResult = " and time > 1388538061s and time < 1388538062s";
|
||||
DateTime startTime = new DateTime(2014, 01, 01, 01, 01, 01, DateTimeZone.UTC);
|
||||
DateTime endTime = new DateTime(2014, 01, 01, 01, 01, 02, DateTimeZone.UTC);
|
||||
|
||||
assert (expectedResult.equals(Utils.WhereClauseBuilder.buildTimePart(startTime, endTime)));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue