aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-11-01 23:47:07 +0100
committersimonbrandhof <simon.brandhof@gmail.com>2011-11-01 23:47:14 +0100
commit75d94af97eec8d3f4f68b3535ffd3365456e490f (patch)
treeff8ee77c9ce1bbc0c7b2198cced28064f40cfe5b /sonar-server
parent9842aa3d39e0892decdb69a60e6e731d1ff00a4b (diff)
downloadsonarqube-75d94af97eec8d3f4f68b3535ffd3365456e490f.tar.gz
sonarqube-75d94af97eec8d3f4f68b3535ffd3365456e490f.zip
Fix unit test
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/test/java/org/sonar/server/filters/DateCriterionTest.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/sonar-server/src/test/java/org/sonar/server/filters/DateCriterionTest.java b/sonar-server/src/test/java/org/sonar/server/filters/DateCriterionTest.java
index 1dc8be73d98..66411a7dc67 100644
--- a/sonar-server/src/test/java/org/sonar/server/filters/DateCriterionTest.java
+++ b/sonar-server/src/test/java/org/sonar/server/filters/DateCriterionTest.java
@@ -19,6 +19,7 @@
*/
package org.sonar.server.filters;
+import org.apache.commons.lang.time.DateUtils;
import org.junit.Test;
import java.text.ParseException;
@@ -43,7 +44,8 @@ public class DateCriterionTest {
public void testDaysAgo() throws ParseException {
DateCriterion criterion = new DateCriterion().setDate(3);
Date date = criterion.getDate();
- assertTrue(date.before(new Date(System.currentTimeMillis() - 2 * DAYS)));
- assertTrue(date.after(new Date(System.currentTimeMillis() - 4 * DAYS)));
+ assertThat(date.getMinutes(), is(0));
+ assertThat(date.getHours(), is(0));
+ assertThat(DateUtils.isSameDay(date, DateUtils.addDays(new Date(), -3)), is(true));
}
}