Change log statements to assert statements on test app

This commit is contained in:
PentaKon 2022-03-22 11:06:23 +02:00
parent a788576972
commit 6810dd9c66
1 changed files with 2 additions and 7 deletions

View File

@ -1,8 +1,5 @@
package com.baeldung.resultsetrowcount;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
@ -10,18 +7,16 @@ import java.sql.Statement;
class RowCounterApp {
static Logger logger = LoggerFactory.getLogger(RowCounterApp.class);
public static void main(String[] args) throws SQLException {
Connection conn = createDummyDB();
String selectQuery = "SELECT * FROM STORAGE";
StandardRowCounter standardCounter = new StandardRowCounter(conn);
logger.info("Standard counter count: {}", standardCounter.getQueryRowCount(selectQuery));
assert standardCounter.getQueryRowCount(selectQuery) == 3;
ScrollableRowCounter scrollableCounter = new ScrollableRowCounter(conn);
logger.info("Scrollable counter count: {}", scrollableCounter.getQueryRowCount(selectQuery));
assert scrollableCounter.getQueryRowCount(selectQuery) == 3;
}
static Connection createDummyDB() throws SQLException {