@Test(expected = NullPointerException.class) public void when_No_RepositoryXO_Provided_Should_Fail() { initializeCleanupAttributes(null); }
public static void initializeCleanupAttributes(final RepositoryXO repositoryXO) { checkNotNull(repositoryXO); Map<String, Map<String, Object>> attributes = checkNotNull(repositoryXO.getAttributes()); Map<String, Object> cleanup = attributes.get(CLEANUP_ATTRIBUTES_KEY); if (nonNull(cleanup)) { @SuppressWarnings("unchecked") Collection<String> policyNames = (Collection<String>) cleanup.get(CLEANUP_NAME_KEY); if(isNull(policyNames) || policyNames.isEmpty()) { attributes.remove(CLEANUP_ATTRIBUTES_KEY); } else { cleanup.put(CLEANUP_NAME_KEY, newLinkedHashSet(policyNames)); } } }
RepositoryCleanupAttributesUtil { public static void initializeCleanupAttributes(final RepositoryXO repositoryXO) { checkNotNull(repositoryXO); Map<String, Map<String, Object>> attributes = checkNotNull(repositoryXO.getAttributes()); Map<String, Object> cleanup = attributes.get(CLEANUP_ATTRIBUTES_KEY); if (nonNull(cleanup)) { @SuppressWarnings("unchecked") Collection<String> policyNames = (Collection<String>) cleanup.get(CLEANUP_NAME_KEY); if(isNull(policyNames) || policyNames.isEmpty()) { attributes.remove(CLEANUP_ATTRIBUTES_KEY); } else { cleanup.put(CLEANUP_NAME_KEY, newLinkedHashSet(policyNames)); } } } }
RepositoryCleanupAttributesUtil { public static void initializeCleanupAttributes(final RepositoryXO repositoryXO) { checkNotNull(repositoryXO); Map<String, Map<String, Object>> attributes = checkNotNull(repositoryXO.getAttributes()); Map<String, Object> cleanup = attributes.get(CLEANUP_ATTRIBUTES_KEY); if (nonNull(cleanup)) { @SuppressWarnings("unchecked") Collection<String> policyNames = (Collection<String>) cleanup.get(CLEANUP_NAME_KEY); if(isNull(policyNames) || policyNames.isEmpty()) { attributes.remove(CLEANUP_ATTRIBUTES_KEY); } else { cleanup.put(CLEANUP_NAME_KEY, newLinkedHashSet(policyNames)); } } } private  RepositoryCleanupAttributesUtil(); }
RepositoryCleanupAttributesUtil { public static void initializeCleanupAttributes(final RepositoryXO repositoryXO) { checkNotNull(repositoryXO); Map<String, Map<String, Object>> attributes = checkNotNull(repositoryXO.getAttributes()); Map<String, Object> cleanup = attributes.get(CLEANUP_ATTRIBUTES_KEY); if (nonNull(cleanup)) { @SuppressWarnings("unchecked") Collection<String> policyNames = (Collection<String>) cleanup.get(CLEANUP_NAME_KEY); if(isNull(policyNames) || policyNames.isEmpty()) { attributes.remove(CLEANUP_ATTRIBUTES_KEY); } else { cleanup.put(CLEANUP_NAME_KEY, newLinkedHashSet(policyNames)); } } } private  RepositoryCleanupAttributesUtil(); static void initializeCleanupAttributes(final RepositoryXO repositoryXO); }
RepositoryCleanupAttributesUtil { public static void initializeCleanupAttributes(final RepositoryXO repositoryXO) { checkNotNull(repositoryXO); Map<String, Map<String, Object>> attributes = checkNotNull(repositoryXO.getAttributes()); Map<String, Object> cleanup = attributes.get(CLEANUP_ATTRIBUTES_KEY); if (nonNull(cleanup)) { @SuppressWarnings("unchecked") Collection<String> policyNames = (Collection<String>) cleanup.get(CLEANUP_NAME_KEY); if(isNull(policyNames) || policyNames.isEmpty()) { attributes.remove(CLEANUP_ATTRIBUTES_KEY); } else { cleanup.put(CLEANUP_NAME_KEY, newLinkedHashSet(policyNames)); } } } private  RepositoryCleanupAttributesUtil(); static void initializeCleanupAttributes(final RepositoryXO repositoryXO);  }