@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()); }
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(); }
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(); } }
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(); }  }
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); }
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);  }