We develop an empirical test aimed at detecting nonergodicity from a s
ingle sample of a spin system. We show that the test is asymptotically
correct, and we give explicit asymptotics for the error probability.
The key tool consists in some new large-deviation estimates.