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