A mixture model approach to empirical Bayes testing and estimation