Refactor tests a bit.