test toArray method.