Black-box group algorithm for abelianness testing