]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5329 - Fixed bracket filter test
authorStephane Gamard <stephane.gamard@searchbox.com>
Thu, 19 Jun 2014 10:14:02 +0000 (12:14 +0200)
committerStephane Gamard <stephane.gamard@searchbox.com>
Thu, 19 Jun 2014 10:15:17 +0000 (12:15 +0200)
sonar-server/src/test/java/org/sonar/server/activity/ActivityServiceMediumTest.java

index 68070daf466769358dc95842ededcf9835b4812c..7e8d9d96af8689863926c7df2f52cf3e3499b93f 100644 (file)
@@ -129,7 +129,7 @@ public class ActivityServiceMediumTest {
 
     ActivityDto activity = ActivityDto.createFor(testValue)
       .setType(Activity.Type.NONE).setAuthor("testing");
-    DateTime t0 = new DateTime();
+    DateTime t0 = new DateTime().minusHours(1);
     activity.setCreatedAt(t0.toDate());
     dao.insert(dbSession, activity);
     dao.insert(dbSession, activity);
@@ -138,28 +138,28 @@ public class ActivityServiceMediumTest {
     activity.setCreatedAt(t1.toDate());
     dao.insert(dbSession, activity);
     dbSession.commit();
-    DateTime t2 = new DateTime();
+    DateTime t2 = new DateTime().plusHours(1);
 
 
     assertThat(service.search(new ActivityQuery()
-        .setSince(t0.minus(10L).toDate()),
+        .setSince(t0.minusSeconds(5).toDate()),
       new QueryOptions()).getHits()).hasSize(3);
 
     assertThat(service.search(new ActivityQuery()
-        .setSince(t1.minus(10L).toDate()),
+        .setSince(t1.minusSeconds(5).toDate()),
       new QueryOptions()).getHits()).hasSize(1);
 
     assertThat(service.search(new ActivityQuery()
-        .setSince(t2.minus(10L).toDate()),
+        .setSince(t2.minusSeconds(5).toDate()),
       new QueryOptions()).getHits()).hasSize(0);
 
     assertThat(service.search(new ActivityQuery()
-        .setTo(t1.minus(10L).toDate()),
+        .setTo(t1.minusSeconds(5).toDate()),
       new QueryOptions()).getHits()).hasSize(2);
 
     assertThat(service.search(new ActivityQuery()
-        .setSince(t1.minus(10L).toDate())
-        .setTo(t2.plus(10L).toDate()),
+        .setSince(t1.minusSeconds(5).toDate())
+        .setTo(t2.plusSeconds(5).toDate()),
       new QueryOptions()).getHits()).hasSize(1);
   }