This is fine, but have you heard of assertItemsEqual()? It basically does just this; sorting the two things you want to compare before checking for equality.