Disabled debug flag when running the unit test.
Additional test for opening the database, and minor modifications.

For testability purpose the static database variable have been moved
to an instance variable, otherwise opening multiple databases would
have been impossible.