I'm writing a test for a website (which uses Node.JS & Angular) using Selenium webdriver & Java. The site has list ordering functionality, where the items are listed in ascending / descending order, based on their names. The purpose here is to verify that the sorting function works properly.
The problem comes when the first letter of the element's name is one from the special Hungarian characters (á,é,ő, etc). When I use the website to sort the items, they will be placed right after their respective "normal" counterparts, but when I use Collections.sort() to manually sort the original, unordered elements extracted earlier, Java will move these elements after the last "normal" letter (z).
Here is an example, let's say our elements are displayed in the following order:
alma
körte
barack
árpa
kukorica
When I use the website's ordering method, the result will be the following:
alma
**árpa**
barack
körte
kukorica
However, Java's Collection.sort() will produce the following ordered list:
alma
barack
körte
kukorica
**árpa**
Technically, the two letters 'a' & 'á' represent the same letter and in our ABC they come right after each other.
My educated guess is Java uses ASCII codes of these characters to determine the order of the elements, where 'á' has higher value than 'a'. For some reason, Node.JS seems to use some sort of 'natural ABC' instead of the ASCII table.
My questions is: is there a way I can force the Collection.sort() to use the same method for sorting as the website?