public void testSortTerm() throws Exception {
Mailbox mailbox = Mailbox.get("bill@localhost");
assertEquals(3, mailbox.size());
// This one has search term *not* set
MockEndpoint mockAsc = getMockEndpoint("mock:resultAscending");
mockAsc.expectedBodiesReceived("Earlier date", "Later date");
// This one has search term set
MockEndpoint mockDesc = getMockEndpoint("mock:resultDescending");
mockDesc.expectedBodiesReceived("Even later date", "Later date", "Earlier date");
// This one has search term set
MockEndpoint mockDescImap = getMockEndpoint("mock:resultDescendingImap");
mockDescImap.expectedBodiesReceived("Even later date", "Later date", "Earlier date");
assertMockEndpointsSatisfied();
}