TimestampTokenConverter { public static TimestampDTO toTimestampDTO(TimestampToken timestampToken) { Objects.requireNonNull(timestampToken, "TimestampToken cannot be null!"); TimestampDTO timestampDTO = new TimestampDTO(timestampToken.getEncoded(), timestampToken.getTimeStampType()); timestampDTO.setCanonicalizationMethod(timestampToken.getCanonicalizationMethod()); timestampDTO.setIncludes(toTimestampIncludeDTOs(timestampToken.getTimestampIncludes())); return timestampDTO; }  static List<TimestampToken> toTimestampTokens(List<TimestampDTO> timestampDTOs); static TimestampToken toTimestampToken(TimestampDTO timestampDTO); static TimestampDTO toTimestampDTO(TimestampToken timestampToken);  }
@Test public void toTimestampDTOTest() throws Exception { TimestampToken timestampToken = new TimestampToken(Utils.fromBase64(timestampBinaries), TimestampType.CONTENT_TIMESTAMP); assertNotNull(timestampToken); timestampToken.setCanonicalizationMethod(CanonicalizationMethod.INCLUSIVE_WITH_COMMENTS); timestampToken.setTimestampIncludes(Arrays.asList(new TimestampInclude("reference-id-1", true))); TimestampDTO timestampDTO = TimestampTokenConverter.toTimestampDTO(timestampToken); assertNotNull(timestampDTO); assertEquals(timestampToken.getTimeStampType(), timestampDTO.getType()); assertEquals(timestampToken.getCanonicalizationMethod(), timestampDTO.getCanonicalizationMethod()); assertEquals(1, timestampDTO.getIncludes().size()); assertEquals("reference-id-1", timestampDTO.getIncludes().get(0).getURI()); assertTrue(timestampDTO.getIncludes().get(0).isReferencedData()); assertTrue(Arrays.equals(timestampToken.getEncoded(), timestampDTO.getBinaries())); }