Refactor Naive Bayes test