SecretContentDAO { public long createSecretContent(long secretId, String encryptedContent, String hmac, String creator, Map<String, String> metadata, long expiry, long now) { SecretsContentRecord r = dslContext.newRecord(SECRETS_CONTENT); String jsonMetadata; try { jsonMetadata = mapper.writeValueAsString(metadata); } catch (JsonProcessingException e) { throw Throwables.propagate(e); } long generatedId = rowHmacGenerator.getNextLongSecure(); String rowHmac = rowHmacGenerator.computeRowHmac( SECRETS_CONTENT.getName(), List.of(encryptedContent, jsonMetadata, generatedId)); r.setId(generatedId); r.setSecretid(secretId); r.setEncryptedContent(encryptedContent); r.setContentHmac(hmac); r.setCreatedby(creator); r.setCreatedat(now); r.setUpdatedby(creator); r.setUpdatedat(now); r.setMetadata(jsonMetadata); r.setExpiry(expiry); r.setRowHmac(rowHmac); r.store(); pruneOldContents(secretId); return r.getId(); } private  SecretContentDAO(DSLContext dslContext, ObjectMapper mapper,
      SecretContentMapper secretContentMapper, RowHmacGenerator rowHmacGenerator,
      KeywhizConfig config); long createSecretContent(long secretId, String encryptedContent, String hmac,
      String creator, Map<String, String> metadata, long expiry, long now); Optional<SecretContent> getSecretContentById(long id); Optional<ImmutableList<SecretContent>> getSecretVersionsBySecretId(long id,
      int versionIdx, int numVersions); long dangerPermanentlyRemoveRecordsForGivenSecretsIDs(List<Long> ids);  }
@Test public void createSecretContent() { int before = tableSize(); secretContentDAO.createSecretContent(secretContent1.secretSeriesId()+1, "encrypted", "checksum", "creator", metadata, 1136214245, OffsetDateTime.now().toEpochSecond()); assertThat(tableSize()).isEqualTo(before + 1); }