public static void sortMessages(Message[] messages, final SortTerm[] sortTerm) {
        final List<SortTermWithDescending> sortTermsWithDescending = getSortTermsWithDescending(sortTerm);
        sortMessages(messages, sortTermsWithDescending);
    }
@Test
    public void testSortMessagesMulti() {
        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. The second term
        // should be ignored since it is already the decider.
        for (SortTerm term1 : POSSIBLE_TERMS) {
            for (SortTerm term2 : POSSIBLE_TERMS) {
                Message[] actual = MESSAGES.clone();
                MailSorter.sortMessages(actual, new SortTerm[] { term1, SortTerm.REVERSE, term2 });
                try {
                    assertArrayEquals(actual, expected);
                } catch (AssertionError ex) {
                    throw new AssertionError(String.format("Terms: %s, %s", term1.toString(), term2.toString()), ex);
                }
            }

        }
    }