Refactored db test