[BZ-1007529] fix the findEndOfMethodArgsIndex() + add several tests