NATO tests electronic defenses in naval exercise