public static void sortMessages(Message[] messages, final SortTerm[] sortTerm) {
        final List<SortTermWithDescending> sortTermsWithDescending = getSortTermsWithDescending(sortTerm);
        sortMessages(messages, sortTermsWithDescending);
    }
@Test
    public void testSortMessages() throws Exception {
        Message[] expected = new Message[] { MESSAGES[0], MESSAGES[1], MESSAGES[2] };

        // Sort using all the terms. Message order should be the same no matter what term is used
        for (SortTerm term : POSSIBLE_TERMS) {
            Message[] actual = MESSAGES.clone();
            MailSorter.sortMessages(actual, new SortTerm[] { term });
            try {
                assertArrayEquals(actual, expected);
            } catch (Exception ex) {
                throw new Exception("Term: " + term.toString(), ex);
            }
        }
    }