mardi 29 septembre 2015

Unit Testing Ignore owner from H2 database

I would like to test multiple methods without having restrictions to access the database. There was legacy code which has the query coded and I was wondering if H2 can ignore those prefixes owner while testing.

For example: in the code...

..
String q = "SELECT user FROM admin_dba.Empolyees where id < ? and id > 25";
try {
    con = DataSourceUtils.getConnection(dataSource);

            pst = con.prepareStatement(q);
            pst.setLong(1,  id);
            rs = pst.executeQuery();
...

as for testing am I able to ignore that admin_dba in H2?

Aucun commentaire:

Enregistrer un commentaire