Make check for useDatabase switchable for unittests.