TimestampTokenConverter { public static List<TimestampToken> toTimestampTokens(List<TimestampDTO> timestampDTOs) { List<TimestampToken> timestampTokens = new ArrayList<>(); if (Utils.isCollectionNotEmpty(timestampDTOs)) { for (TimestampDTO timestampDTO : timestampDTOs) { if (timestampDTO != null && Utils.isArrayNotEmpty(timestampDTO.getBinaries())) { try { timestampTokens.add(toTimestampToken(timestampDTO)); } catch (DSSException e) { LOG.warn(e.getMessage()); } } } } return timestampTokens; }  static List<TimestampToken> toTimestampTokens(List<TimestampDTO> timestampDTOs); static TimestampToken toTimestampToken(TimestampDTO timestampDTO); static TimestampDTO toTimestampDTO(TimestampToken timestampToken);  }
@Test public void toTimestampTokenListTest() throws Exception { List<TimestampDTO> timestampDTOs = new ArrayList<>(); timestampDTOs.add(null); timestampDTOs.add(new TimestampDTO()); timestampDTOs.add(new TimestampDTO(Utils.fromBase64(timestampBinaries), TimestampType.INDIVIDUAL_DATA_OBJECTS_TIMESTAMP)); List<TimestampToken> timestampTokens = TimestampTokenConverter.toTimestampTokens(timestampDTOs); assertEquals(1, timestampTokens.size()); TimestampToken timestampToken = timestampTokens.get(0); assertNotNull(timestampToken); assertEquals(TimestampType.INDIVIDUAL_DATA_OBJECTS_TIMESTAMP, timestampToken.getTimeStampType()); assertTrue(Arrays.equals(Utils.fromBase64(timestampBinaries), timestampToken.getEncoded())); }