SituationUtil { public static byte[] serializeSituation(Situation situation) throws Exception { byte[] ret=null; java.io.ByteArrayOutputStream baos=new java.io.ByteArrayOutputStream(); MAPPER.writeValue(baos, situation); ret = baos.toByteArray(); baos.close(); return (ret); } private  SituationUtil(); static byte[] serializeSituation(Situation situation); static byte[] serializeIgnoreSubject(IgnoreSubject ignore); static Situation deserializeSituation(byte[] situation); static IgnoreSubject deserializeIgnoreSubject(byte[] ignore);  }
@Test public void testSerializeSituationProperties() { Situation situation=new Situation(); situation.getSituationProperties().put(TEST_PROPERTY, TEST_PROPERTY_VALUE); String json=null; try { byte[] b=SituationUtil.serializeSituation(situation); if (b != null) { json = new String(b); } } catch (Exception e) { fail("Failed to serialize: "+e); } assertNotNull(json); if (json.contains("situationProperties")) { fail("Field 'situationProperties' should not be present in json"); } if (!json.contains("properties")) { fail("Field 'properties' should" + " be present in json"); } }