Refactored iterator in test to check specific values in array