Reduce duplicate code and add a new test.