Refactor test for and operator