This code looks very duplicated across tests from each type, which is not going to be good for maintainability. Can you refactor the common logic out?