Sampling and hypothesis testing