Is it possible for optometrist to test how good your sunglasses are?

No. Optometrists, opticians and ophthalmologists (the real eye doctors), can test for the power of your glasses. But it takes specialized scientific equipment not usually available to determine the effectiveness at blocking harmful light by sunglass lenses. Purveyors of sunglasses depend upon the honesty of the manufacturers in determining the effectivess of the products sold.
Yes. Some optical shops have machines which can read the efficiency of uv filtering. Just call around.