### Question:
ConfigPropertyServiceImpl implements ConfigPropertyService { @Override public ConfigPropertyRollbackPreview getRollbackPreview(String timestamp) throws Exception { ConfigPropertyAuditTrail trail = listAllConfigPropertyAudits(timestamp); List<ConfigPropertyRollBackItem> rollBackItemList = new ArrayList<>(); for (ConfigPropertyAuditItem auditItem : trail.getConfigPropertyAudit()) { for (ConfigPropertyDataChange changeItem : auditItem.getConfigPropertyChangeList()) { ConfigPropertyRollBackItem existingRollBackItem = getRollBackItemIfExists(rollBackItemList, changeItem); if (null == existingRollBackItem) { ConfigPropertyRollBackItem rollBackItem = new ConfigPropertyRollBackItem(); rollBackItem.setApplication(changeItem.getApplication()); rollBackItem.setConfigKey(changeItem.getConfigKey()); rollBackItem.setPresentConfigValue( changeItem.getNewConfigValue() == null ? "" : changeItem.getNewConfigValue()); rollBackItem.setFutureConfigValue( changeItem.getOldConfigValue() == null ? "" : changeItem.getOldConfigValue()); rollBackItemList.add(rollBackItem); } else { existingRollBackItem.setFutureConfigValue( changeItem.getOldConfigValue() == null ? "" : changeItem.getOldConfigValue()); } } } List<ConfigPropertyRollBackItem> refinedRollBackItemList = syncWithPresentSystemState(rollBackItemList); ConfigPropertyRollbackPreview preview = new ConfigPropertyRollbackPreview(); preview.setRollbackChangeSet(refinedRollBackItemList); preview.setRestoreToTimestamp(timestamp); return preview; }  @Override ConfigTreeNode listProperties(); @Override @Transactional List<ConfigProperty> addUpdateProperties(ConfigPropertyRequest configPropertyRequest, String user,
			String userMessage, String timeNow, boolean partOfRollbackOperation); @Override @Transactional String deleteProperty(ConfigPropertyItem configPropertyItem, String user, String userMessage, String timeNow,
			boolean partOfRollbackOperation); @Override boolean isAllPropertiesExisting(ConfigPropertyRequest configPropertyRequest); @Override boolean isAnyPropertyExisting(ConfigPropertyRequest configPropertyRequest); @Override boolean isPropertyExisting(ConfigPropertyItem configPropertyItem); @Override boolean isCfkeyExisting(String cfkey); @Override boolean isAllCfkeysExisting(ConfigPropertyRequest configPropertyRequest); @Override boolean isApplicationExisting(String application); @Override boolean isAllApplicationsExisting(ConfigPropertyRequest configPropertyRequest); @Override List<String> listAllKeys(); @Override ConfigPropertyAuditTrail listAllConfigPropertyAudits(String timestamp); @Override ConfigPropertyRollbackPreview getRollbackPreview(String timestamp); @Override @Transactional String doConfigPropertyRollbackToTimestamp(String timestamp, String user, String userMessage); @Override List<ConfigProperty> listProperty(String cfkey, String application);  }### Answer:
@Test public void testgetRollbackPreview() throws Exception { List<ConfigPropertyAudit> configPropertyAuditList = new ArrayList<>(); ConfigPropertyAudit auditItem1 = new ConfigPropertyAudit(); auditItem1.setApplication("application"); auditItem1.setCfkey("logging.esHost"); auditItem1.setLabel("latest"); auditItem1.setOldvalue("old"); auditItem1.setNewvalue("new"); auditItem1.setModifiedDate("01/01/2013 01:01:01"); configPropertyAuditList.add(auditItem1); ConfigPropertyAudit auditItem2 = new ConfigPropertyAudit(); auditItem2.setApplication("application"); auditItem2.setCfkey("logging.esHost"); auditItem2.setLabel("latest"); auditItem2.setOldvalue("new"); auditItem2.setNewvalue("newest"); auditItem2.setModifiedDate("02/02/2013 01:01:01"); configPropertyAuditList.add(auditItem2); when(configPropertyAuditRepository.findAllByOrderByModifiedDateDescModifiedByAsc()) .thenReturn(configPropertyAuditList); assertTrue(configPropertyService.getRollbackPreview("01/01/2012 01:01:01").getRollbackChangeSet().size() > 0); }