How about using `lambda` for this test? That will simplify our codes.