SearchHistorySerialization { Serializer<List<SearchHistory>, String> serializer(){ return serializer; } SearchHistorySerialization();   }
@Test(dataProvider = "toSerializerData") public void testSerializer(SearchHistory searchHistory, String expected) throws Exception { final String serialized = new SearchHistorySerialization().serializer().serialize(Collections.singletonList(searchHistory)); assertEquals(serialized,expected); }