Code example for DefaultFormattingConversionService

0
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.format.support.DefaultFormattingConversionService;
 
public class FilterTest { 
 
	private static final GenericConversionService genericConversionService = new DefaultFormattingConversionService();
 
	@Test
	public void testDateFilterGT() { 
		Map<String, Object> json = new HashMap<String, Object>();
		json.put("field", "aField");
		json.put("type", "date");
		json.put("value", "12.12.2010");
		json.put("comparison", "gt");
 
		Filter filter = Filter.createFilter(json, genericConversionService);
		assertThat(filter).isInstanceOf(DateFilter.class); 
		DateFilter dateFilter = (DateFilter) filter;
		assertThat(dateFilter.getField()).isEqualTo("aField");
		assertThat(dateFilter.getValue()).isEqualTo("12.12.2010");