aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2012-12-03 15:28:29 +0100
committerJulien Lancelot <julien.lancelot@gmail.com>2012-12-03 15:28:29 +0100
commit827c047c411d86101d08b8845a9395b5c1bfcdff (patch)
tree9b75262753619257a0fefe29d363dac3fe75de37 /sonar-core
parentd0b2fd9f885ab5e6651e0b0ec4d72d863e672449 (diff)
downloadsonarqube-827c047c411d86101d08b8845a9395b5c1bfcdff.tar.gz
sonarqube-827c047c411d86101d08b8845a9395b5c1bfcdff.zip
SONAR-3306 Improve unit test to fix issue on it-sonar-persistence tests
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/test/java/org/sonar/core/persistence/SemaphoreDaoTest.java12
1 files changed, 3 insertions, 9 deletions
diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/SemaphoreDaoTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/SemaphoreDaoTest.java
index 7f7a86d720a..30fd3363958 100644
--- a/sonar-core/src/test/java/org/sonar/core/persistence/SemaphoreDaoTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/persistence/SemaphoreDaoTest.java
@@ -73,14 +73,12 @@ public class SemaphoreDaoTest extends AbstractDaoTestCase {
@Test
public void create_and_acquire_semaphore() throws Exception {
- LOG.info("create_and_acquire_semaphore");
SemaphoreDao dao = new SemaphoreDao(getMyBatis());
Lock lock = dao.acquire("foo", 60);
assertThat(lock.isAcquired()).isTrue();
assertThat(lock.getDurationSinceLocked()).isNull();
SemaphoreDto semaphore = selectSemaphore("foo");
- LOG.info("semaphore : " + semaphore);
assertThat(semaphore).isNotNull();
assertThat(semaphore.getName()).isEqualTo("foo");
assertThat(isRecent(semaphore.getCreatedAt())).isTrue();
@@ -239,13 +237,9 @@ public class SemaphoreDaoTest extends AbstractDaoTestCase {
}
private boolean isRecent(Date date) {
- LOG.info("**** Date : " + date);
- Date now = now();
- LOG.info("**** Now : " + now);
- Date dateInTheFuture = DateUtils.addDays(date, 1);
- LOG.info("**** DateInTheFuture : " + dateInTheFuture);
- LOG.info("date.before(now) -> " + date.before(now) + " && dateInTheFuture.after(date) -> " + dateInTheFuture.after(date));
- return date.before(now) && dateInTheFuture.after(now);
+ Date futur = DateUtils.addDays(now(), 1);
+ Date past = DateUtils.addDays(now(), -1);
+ return date.after(past) && date.before(futur);
}
private Date now() {