SearchHistorySerialization { Deserializer<ArrayList<SearchHistory>, String> deserializer() { return deserializer; } SearchHistorySerialization();   }
@Test public void testDeserializer() throws Exception { String data = "[\n" + " {\n" + " \"query\": \"s+\",\n" + " \"searchMode\": \"REGEX\"\n" + " },\n" + " {\n" + " \"query\": \"text\",\n" + " \"searchMode\": \"STRING_CONTAINS\"\n" + " },\n" + " {\n" + " \"query\": \"level>INFO\",\n" + " \"searchMode\": \"QUERY\"\n" + " }\n" + "]"; final Optional<ArrayList<SearchHistory>> deserialize = new SearchHistorySerialization().deserializer().deserialize(data); assertTrue(deserialize.isPresent()); deserialize.ifPresent(list -> { assertEquals(list.get(0).getQuery(), "s+"); assertEquals(list.get(0).getSearchMode(), SearchAction.SearchMode.REGEX); assertEquals(list.get(1).getQuery(), "text"); assertEquals(list.get(1).getSearchMode(), SearchAction.SearchMode.STRING_CONTAINS); assertEquals(list.get(2).getQuery(), "level>INFO"); assertEquals(list.get(2).getSearchMode(), SearchAction.SearchMode.QUERY); }); }