From 15785e4fa0682b3a86dc25461caea841e8acd4a8 Mon Sep 17 00:00:00 2001 From: Sylvain Palominos Date: Wed, 27 Nov 2019 12:35:09 +0100 Subject: [PATCH] Increase code coverage. --- .../orbisgis/datamanager/JdbcTableTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/data-manager/src/test/java/org/orbisgis/datamanager/JdbcTableTest.java b/data-manager/src/test/java/org/orbisgis/datamanager/JdbcTableTest.java index b47d1d8e..e3138776 100644 --- a/data-manager/src/test/java/org/orbisgis/datamanager/JdbcTableTest.java +++ b/data-manager/src/test/java/org/orbisgis/datamanager/JdbcTableTest.java @@ -561,6 +561,25 @@ public void testSqlBuilding() { assertEquals("SELECT * FROM ORBISGIS LIMIT 0", getTable().limit(0).toString().trim()); } + /** + * Test the {@link JdbcTable#columns(String...)} and {@link JdbcTable#columns(List)} methods. + */ + @Test + public void testColumns() { + JdbcTable table = getTable(); + JdbcSpatialTable spatialTable = (JdbcSpatialTable)dataSource.getSpatialTable(TABLE_NAME); + + List columns = new ArrayList<>(); + columns.add("TOTO"); + columns.add("tata"); + columns.add("TIti"); + + assertEquals("SELECT TOTO, tata, TIti FROM ORBISGIS WHERE toto", ((JdbcTable)table.columns("TOTO", "tata", "TIti")).where("toto").toString().trim()); + assertEquals("SELECT TOTO, tata, TIti FROM ORBISGIS WHERE toto", ((JdbcTable)table.columns(columns)).where("toto").toString().trim()); + assertEquals("SELECT TOTO, tata, TIti FROM ORBISGIS WHERE toto", ((JdbcTable)spatialTable.columns("TOTO", "tata", "TIti")).where("toto").toString().trim()); + assertEquals("SELECT TOTO, tata, TIti FROM ORBISGIS WHERE toto",((JdbcTable) spatialTable.columns(columns)).where("toto").toString().trim()); + } + /** * Test the {@link JdbcTable#getTable()} and {@link JdbcTable#getSpatialTable()} methods. */