unit test for NewSample()