SimpleSortFieldBuilder extends SortFieldBuilder<SimpleSortField, SimpleSortFieldBuilder> { @Override public SimpleSortField build() { return new SimpleSortField(field, reverse); } @JsonCreator  SimpleSortFieldBuilder(@JsonProperty("field") String field); @Override SimpleSortField build();  }
@Test public void testBuild() { String field = "field"; SimpleSortFieldBuilder builder = new SimpleSortFieldBuilder(field).reverse(true); SimpleSortField sortField = builder.build(); assertNotNull("SimpleSortField is not built", sortField); assertEquals("SimpleSortField field name is not set", field, sortField.getField()); assertEquals("SimpleSortField reverse is not set", true, sortField.reverse); }
@Test public void testBuildDefault() { String field = "field"; SimpleSortFieldBuilder builder = new SimpleSortFieldBuilder(field); SimpleSortField sortField = builder.build(); assertNotNull("SimpleSortField is not built", sortField); assertEquals("SimpleSortField field name is not set", field, sortField.getField()); assertEquals("SimpleSortField reverse is not set to default", SortField.DEFAULT_REVERSE, sortField.reverse); }
@Test public void testBuildReverse() { String field = "field"; SimpleSortFieldBuilder builder = new SimpleSortFieldBuilder(field).reverse(false); SimpleSortField sortField = builder.build(); assertNotNull("SimpleSortField is not built", sortField); assertEquals("SimpleSortField field name is not set", field, sortField.getField()); assertEquals("SimpleSortField reverse is not set", false, sortField.reverse); }