ActiveCollectionUtil { @SuppressWarnings("unchecked") public static java.util.List<ActiveCollectionSource> deserializeACS(byte[] acs) throws Exception { java.util.List<ActiveCollectionSource> ret=null; java.io.ByteArrayInputStream bais=new java.io.ByteArrayInputStream(acs); ret = (java.util.List<ActiveCollectionSource>)MAPPER.readValue(bais, TYPEREF); bais.close(); return (ret); } private  ActiveCollectionUtil(); static byte[] serializeACS(java.util.List<ActiveCollectionSource> acs); @SuppressWarnings("unchecked") static java.util.List<ActiveCollectionSource> deserializeACS(byte[] acs); static byte[] serializeQuerySpec(QuerySpec qs); static QuerySpec deserializeQuerySpec(byte[] qs);  }
@Test public void testDeserializeACS() { try { java.io.InputStream is=ActiveCollectionUtilTest.class.getResourceAsStream("/jsondata/acs.json"); byte[] b = new byte[is.available()]; is.read(b); is.close(); java.util.List<ActiveCollectionSource> acslist=ActiveCollectionUtil.deserializeACS(b); if (acslist.size() != 1) { fail("List should have 1 source: "+acslist.size()); } if (!acslist.get(0).getName().equals("TestACS")) { fail("Name is not correct: "+acslist.get(0).getName()); } if (acslist.get(0).getItemExpiration() != 200) { fail("Item expiration is not correct: "+acslist.get(0).getItemExpiration()); } if (acslist.get(0).getMaxItems() != 1000) { fail("Max items is not correct: "+acslist.get(0).getMaxItems()); } } catch(Exception e) { e.printStackTrace(); fail("Failed to deserialize: "+e); } }