Change log statements to assert statements on test app
This commit is contained in:
parent
a788576972
commit
6810dd9c66
@ -1,8 +1,5 @@
|
|||||||
package com.baeldung.resultsetrowcount;
|
package com.baeldung.resultsetrowcount;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@ -10,18 +7,16 @@ import java.sql.Statement;
|
|||||||
|
|
||||||
class RowCounterApp {
|
class RowCounterApp {
|
||||||
|
|
||||||
static Logger logger = LoggerFactory.getLogger(RowCounterApp.class);
|
|
||||||
|
|
||||||
public static void main(String[] args) throws SQLException {
|
public static void main(String[] args) throws SQLException {
|
||||||
Connection conn = createDummyDB();
|
Connection conn = createDummyDB();
|
||||||
|
|
||||||
String selectQuery = "SELECT * FROM STORAGE";
|
String selectQuery = "SELECT * FROM STORAGE";
|
||||||
|
|
||||||
StandardRowCounter standardCounter = new StandardRowCounter(conn);
|
StandardRowCounter standardCounter = new StandardRowCounter(conn);
|
||||||
logger.info("Standard counter count: {}", standardCounter.getQueryRowCount(selectQuery));
|
assert standardCounter.getQueryRowCount(selectQuery) == 3;
|
||||||
|
|
||||||
ScrollableRowCounter scrollableCounter = new ScrollableRowCounter(conn);
|
ScrollableRowCounter scrollableCounter = new ScrollableRowCounter(conn);
|
||||||
logger.info("Scrollable counter count: {}", scrollableCounter.getQueryRowCount(selectQuery));
|
assert scrollableCounter.getQueryRowCount(selectQuery) == 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Connection createDummyDB() throws SQLException {
|
static Connection createDummyDB() throws SQLException {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user