@Test
public void testParse() {

    // null expression
    assertEquals(Ordering.empty().getFields(), Ordering.parse(null).getFields());
    // empty expression
    assertEquals(Ordering.empty().getFields(), Ordering.parse("").getFields());
    // single field expression
    assertEquals(
        ImmutableMap.of(Ordering.Field.NAME, Ordering.Direction.ASCENDING),
        Ordering.parse("name").getFields()
    );
    // single descending field expression
    assertEquals(
        ImmutableMap.of(Ordering.Field.NAME, Ordering.Direction.DESCENDING),
        Ordering.parse("-name").getFields()
    );
    // multiple fields
    assertEquals(
        ImmutableMap.of(
            Ordering.Field.ACTIVE, Ordering.Direction.ASCENDING,
            Ordering.Field.NAME, Ordering.Direction.DESCENDING,
            Ordering.Field.CREATED, Ordering.Direction.ASCENDING
        ),
        Ordering.parse("active,-name,created").getFields()
    );
}