tests: factor out tests into classes.