DateMapper extends SingleColumnMapper.SingleFieldMapper<Long> { @Override public SortField sortField(String name, boolean reverse) { return new SortedNumericSortField(name, Type.LONG, reverse); } DateMapper(String field, String column, Boolean validated, String pattern); @Override Optional<Field> indexedField(String name, Long value); @Override Optional<Field> sortedField(String name, Long value); @Override SortField sortField(String name, boolean reverse); @Override String toString(); final DateParser parser; }
@Test public void testSortField() { DateMapper mapper = dateMapper().pattern("yyyyMMdd").build("name"); SortField sortField = mapper.sortField("name", true); assertNotNull("SortField is not built", sortField); assertTrue("SortField reverse is wrong", sortField.getReverse()); }