I have a class where i have created connection to h2 database using old jdbc method of writing url and getting connection , and I am creating a table in the database, this is table is not a java object so i am running out of clever ways to write a test for my methods 
This one of the methods 

```
//above would be the url and driver connection

```

//also i created a table app\_user
 public void addUser(Connection connection,
 String login, String password,
 String description) throws SQLException {

```
        System.out.println(String.format("Add user : %s", login));

        String newUSer = "INSERT INTO app_user(login, password, description) VALUES (?,?,?)";

        try (PreparedStatement preparedStatement = connection.prepareStatement(newUSer)) {

            preparedStatement.setString(1, login);
            preparedStatement.setString(2, password);
            preparedStatement.setString(3, description);

            // returns number of changed column
            preparedStatement.executeUpdate();
        }
    }

```

And my test method looks like this , is there any way to make it less tidious and more simple , i tried to to mocking with mockito but my app\_user table is not an object of a class App\_user , so i wrote this

```
@Test
    public void addUser() throws SQLException, ClassNotFoundException {

        Class.forName("org.h2.Driver");
        try (Connection connection = DriverManager.getConnection(URL, "sa", "")) {

            String createTable =
                    "CREATE TABLE app_user(" +
                            "user_id INT NOT NULL AUTO_INCREMENT," +
                            "login VARCHAR (255) NOT NULL ," +
                            "password VARCHAR (255) NOT NULL ," +
                            "description VARCHAR (255) NULL," +
                            "PRIMARY KEY (user_id))";

            try (Statement statement = connection.createStatement()) {
                statement.executeUpdate(createTable);
                Assert.assertNotNull(statement);
            }

            String addUser = "INSERT INTO app_user(login, password, description) VALUES (1234,'valentine','javaMan')";
            PreparedStatement statement = connection.prepareStatement(addUser);
            int rowAffected = statement.executeUpdate();

            Assert.assertNotNull(rowAffected);
            Assert.assertEquals(rowAffected,1);
        }

```

But i dont like the fact that in my test i had create connection again, Note-for some reason i cant use objects as table