@org.junit.Test public void testSerialToJson() throws JsonGenerationException, JsonMappingException, IOException {
  final List<RunningQuery> rQueriesOrig=deserialize(rQueryJson);
  final List<RunningQuery> rQueriesDeserial;
  final StringWriter sw=new StringWriter();
  JsonHelper.writeRunningQueryList(sw,rQueriesOrig);
  final String jsonResult=sw.toString();
  assert (jsonResult != null);
  rQueriesDeserial=deserialize(jsonResult);
  final Iterator<RunningQuery> it1=rQueriesOrig.iterator();
  final Iterator<RunningQuery> it2=rQueriesDeserial.iterator();
  while (it1.hasNext() && it2.hasNext()) {
    final RunningQuery r1=it1.next();
    final RunningQuery r2=it2.next();
    assertEquals(r1.getBegin(),r2.getBegin());
    assertEquals(r1.getQueryUuid(),r2.getQueryUuid());
    assertEquals(r1.getExtQueryId(),r2.getExtQueryId());
  }
  assert (!it1.hasNext());
  assert (!it2.hasNext());
}

@ org . junit . Test public void testSerialToJson ( ) throws JsonGenerationException , JsonMappingException , IOException { final List < RunningQuery > rQueriesOrig = deserialize ( rQueryJson ) ; final List < RunningQuery > rQueriesDeserial ; final StringWriter sw = new StringWriter ( ) ; JsonHelper . writeRunningQueryList ( sw , rQueriesOrig ) ; final String jsonResult = sw . toString ( ) ; assert ( jsonResult != null ) ; rQueriesDeserial = deserialize ( jsonResult ) ; final Iterator < RunningQuery > it1 = rQueriesOrig . iterator ( ) ; final Iterator < RunningQuery > it2 = rQueriesDeserial . iterator ( ) ; while ( it1 . hasNext ( ) && it2 . hasNext ( ) ) { final RunningQuery r1 = it1 . next ( ) ; final RunningQuery r2 = it2 . next ( ) ; assertEquals ( r1 . getBegin ( ) , r2 . getBegin ( ) ) ; assertEquals ( r1 . getQueryUuid ( ) , r2 . getQueryUuid ( ) ) ; assertEquals ( r1 . getExtQueryId ( ) , r2 . getExtQueryId ( ) ) ; } assert ( ! it1 . hasNext ( ) ) ; assert ( ! it2 . hasNext ( ) ) ; }
test the serialization from java objects to json
