### Question:
DbHostAuth extends AbstractDbDataDao<Host> { public static String getJson(final DbPreparedStatement preparedStatement, final int limit) throws WaarpDatabaseNoConnectionException, WaarpDatabaseSqlException { final ArrayNode arrayNode = JsonHandler.createArrayNode(); try { preparedStatement.executeQuery(); int nb = 0; while (preparedStatement.getNext()) { final DbHostAuth host = getFromStatement(preparedStatement); final ObjectNode node = host.getInternalJson(); arrayNode.add(node); nb++; if (nb >= limit) { break; } } } finally { preparedStatement.realClose(); } return JsonHandler.writeAsString(arrayNode); } DbHostAuth(final String hostid, final String address, final int port,
                    final boolean isSSL, final byte[] hostkey,
                    final boolean adminrole, final boolean isClient); private  DbHostAuth(final Host host);  DbHostAuth(final ObjectNode source);  DbHostAuth(final String hostid); private  DbHostAuth(); @Override void setFromJson(final ObjectNode node, final boolean ignorePrimaryKey); static DbHostAuth[] deleteAll(); static DbHostAuth[] getAllHosts(); static DbHostAuth getFromStatement(
      final DbPreparedStatement preparedStatement); static DbHostAuth[] getUpdatedPreparedStatement(); static DbPreparedStatement getFilterPrepareStament(
      final DbSession session, final String host, final String addr,
      final boolean ssl, final boolean active); static DbPreparedStatement getFilterPrepareStament(
      final DbSession session, final String host, final String addr); @Override void changeUpdatedInfo(final UpdatedInfo info); boolean isActive(); void setActive(final boolean isActive); boolean isProxified(); void setProxified(final boolean isProxified); boolean isKeyValid(final byte[] newkey); byte[] getHostkey(); boolean isAdminrole(); boolean isClient(); boolean isNoAddress(); SocketAddress getSocketAddress(); boolean isSsl(); String getHostid(); String getAddress(); int getPort(); @Override String toString(); static String getJson(final DbPreparedStatement preparedStatement,
                               final int limit); String getJsonAsString(); String toSpecializedHtml(final R66Session session, final String body,
                                  final boolean crypted); static boolean hasProxifiedHosts(); static final String DEFAULT_CLIENT_ADDRESS; static final int[] dbTypes; static final String table; }### Answer:
@Test public void testJsonSerialisation() { DbHostAuth dbHostConf = new DbHostAuth("hostid", "127.0.0.1", 6666, false, null, true, true); String expected = "{" + "\"@model\":\"DbHostAuth\"," + "\"HOSTID\":\"hostid\"," + "\"ADDRESS\":\"127.0.0.1\"," + "\"PORT\":6666," + "\"HOSTKEY\":null," + "\"ISSSL\":false," + "\"ISCLIENT\":true," + "\"ISPROXIFIED\":false," + "\"ADMINROLE\":true," + "\"ISACTIVE\":true," + "\"UPDATEDINFO\":0" + "}"; ObjectNode asJson = dbHostConf.getJson(); String got = JsonHandler.writeAsString(asJson); assertEquals(expected, got); }