### Question:
SortingConverter { public Sorting convert(Sort sort) { Iterator<Order> order = sort.iterator(); if (order.hasNext()) { Order next = order.next(); String property = next.getProperty(); if (JudgmentIndexField.hasFieldName(property)) { return new Sorting(JudgmentIndexField.valueOf(property).getFieldName(), convertDirection(next.getDirection())); } return Sorting.relevanceSorting(convertDirection(next.getDirection())); } return Sorting.relevanceSorting(); }  Sorting convert(Sort sort);  }### Answer:
@Test @UseDataProvider("convertData") public void convert(Sorting expectedSorting, Order givenOrder) { Sorting retSorting = sortingConverter.convert(new Sort(givenOrder)); assertEquals(expectedSorting.getDirection(), retSorting.getDirection()); assertEquals(expectedSorting.getFieldName(), retSorting.getFieldName()); }
@Test public void convert_relevance() { Order order = new Order(Direction.DESC, "RELEVANCE"); Sort sort = new Sort(order); Sorting actual = sortingConverter.convert(sort); assertEquals(Sorting.relevanceSorting().getFieldName(), actual.getFieldName()); assertEquals(Sorting.Direction.DESC, actual.getDirection()); }
@Test public void convert_relevance_asc() { Order order = new Order(Direction.ASC, "RELEVANCE"); Sort sort = new Sort(order); Sorting actual = sortingConverter.convert(sort); assertEquals(Sorting.relevanceSorting().getFieldName(), actual.getFieldName()); assertEquals(Sorting.Direction.ASC, actual.getDirection()); }