Refactored nested array checks into filtering array and using assertEquals