@Test public void test_calculateChecksum_emptyList() throws Exception{ String checksum1 = componentService.calculateChecksum(new ArrayList<Component>()); String checksum2 = componentService.calculateChecksum(new ArrayList<Component>()); assert checksum1 != null; assert checksum2 != null; assertTrue("Checksums match",StringUtils.equals(checksum1,checksum2)); }
protected String calculateChecksum(List<Component> components) { Collections.sort(components, new Comparator<Component>() { @Override public int compare(Component component1, Component component2) { return CompareToBuilder.reflectionCompare(component1, component2); } }); return ChecksumUtils.calculateChecksum(components); }
ComponentServiceImpl implements ComponentService { protected String calculateChecksum(List<Component> components) { Collections.sort(components, new Comparator<Component>() { @Override public int compare(Component component1, Component component2) { return CompareToBuilder.reflectionCompare(component1, component2); } }); return ChecksumUtils.calculateChecksum(components); } }
ComponentServiceImpl implements ComponentService { protected String calculateChecksum(List<Component> components) { Collections.sort(components, new Comparator<Component>() { @Override public int compare(Component component1, Component component2) { return CompareToBuilder.reflectionCompare(component1, component2); } }); return ChecksumUtils.calculateChecksum(components); }  }
ComponentServiceImpl implements ComponentService { protected String calculateChecksum(List<Component> components) { Collections.sort(components, new Comparator<Component>() { @Override public int compare(Component component1, Component component2) { return CompareToBuilder.reflectionCompare(component1, component2); } }); return ChecksumUtils.calculateChecksum(components); }  @Override Component getComponentByCode(String namespaceCode, String componentCode); @Override List<Component> getAllComponentsByNamespaceCode(String namespaceCode); @Override List<Component> getActiveComponentsByNamespaceCode(String namespaceCode); @Override List<Component> getDerivedComponentSet(String componentSetId); @Override @Transactional void publishDerivedComponents(String componentSetId, List<Component> components); ComponentSetDao getComponentSetDao(); void setComponentSetDao(ComponentSetDao componentSetDao); DataObjectService getDataObjectService(); @Required void setDataObjectService(DataObjectService dataObjectService); }
ComponentServiceImpl implements ComponentService { protected String calculateChecksum(List<Component> components) { Collections.sort(components, new Comparator<Component>() { @Override public int compare(Component component1, Component component2) { return CompareToBuilder.reflectionCompare(component1, component2); } }); return ChecksumUtils.calculateChecksum(components); }  @Override Component getComponentByCode(String namespaceCode, String componentCode); @Override List<Component> getAllComponentsByNamespaceCode(String namespaceCode); @Override List<Component> getActiveComponentsByNamespaceCode(String namespaceCode); @Override List<Component> getDerivedComponentSet(String componentSetId); @Override @Transactional void publishDerivedComponents(String componentSetId, List<Component> components); ComponentSetDao getComponentSetDao(); void setComponentSetDao(ComponentSetDao componentSetDao); DataObjectService getDataObjectService(); @Required void setDataObjectService(DataObjectService dataObjectService);  }