pushOntoArray method and unit test