]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3636 Improve unit test
authorFabrice Bellingard <fabrice.bellingard@sonarsource.com>
Thu, 27 Sep 2012 09:51:23 +0000 (11:51 +0200)
committerFabrice Bellingard <fabrice.bellingard@sonarsource.com>
Thu, 27 Sep 2012 09:51:23 +0000 (11:51 +0200)
sonar-batch/src/test/java/org/sonar/batch/index/DefaultResourcePersisterTest.java

index 2068dbee67df42e6d136695d92d174908d336686..75f86585fed8c34c8f9b7da3dc45a14a4265bd89 100644 (file)
@@ -21,6 +21,7 @@ package org.sonar.batch.index;
 
 import org.junit.Before;
 import org.junit.Test;
+import org.sonar.api.database.model.ResourceModel;
 import org.sonar.api.resources.JavaFile;
 import org.sonar.api.resources.JavaPackage;
 import org.sonar.api.resources.Library;
@@ -30,6 +31,7 @@ import org.sonar.jpa.test.AbstractDbUnitTestCase;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 
+import static org.fest.assertions.Assertions.assertThat;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.notNullValue;
@@ -68,6 +70,10 @@ public class DefaultResourcePersisterTest extends AbstractDbUnitTestCase {
     persister.saveProject(singleProject, null);
 
     checkTables("shouldSaveNewProject", new String[] {"build_date", "created_at"}, "projects", "snapshots");
+
+    // SONAR-3636 : created_at must be fed when inserting a new entry in the 'projects' table
+    ResourceModel model = getSession().getSingleResult(ResourceModel.class, "key", singleProject.getKey());
+    assertThat(model.getCreatedAt()).isNotNull();
   }
 
   @Test