]> source.dussan.org Git - sonarqube.git/commitdiff
Add test to ResultSetIteratorTest
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 21 Nov 2014 13:40:47 +0000 (14:40 +0100)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 21 Nov 2014 13:40:47 +0000 (14:40 +0100)
server/sonar-server/src/test/java/org/sonar/server/db/ResultSetIteratorTest.java

index 0e1ba81cc9edd08f17675e1ecb15723d619f61bf..fad6135bc30dd49c10161d96ec7fa723b2389705 100644 (file)
@@ -52,7 +52,7 @@ public class ResultSetIteratorTest {
   }
 
   @Test
-  public void iterate_through_statement() throws Exception {
+  public void create_iterator_from_statement() throws Exception {
     dbTester.prepareDbUnit(getClass(), "feed.xml");
 
     PreparedStatement stmt = connection.prepareStatement("select * from fake order by id");
@@ -77,7 +77,17 @@ public class ResultSetIteratorTest {
   }
 
   @Test
-  public void iterate_through_rs() throws Exception {
+  public void iterate_empty_list() throws Exception {
+    dbTester.prepareDbUnit(getClass(), "feed.xml");
+
+    PreparedStatement stmt = connection.prepareStatement("select * from fake where id < 0");
+    FirstIntColumnIterator iterator = new FirstIntColumnIterator(stmt);
+
+    assertThat(iterator.hasNext()).isFalse();
+  }
+
+  @Test
+  public void create_iterator_from_result_set() throws Exception {
     dbTester.prepareDbUnit(getClass(), "feed.xml");
 
     PreparedStatement stmt = connection.prepareStatement("select * from fake order by id");