Updated EntitySortOrder.java implementation.
Created more tests.