PdpPolicyDefinition { @JsonIgnore public void sortLoas() { Collections.sort(this.loas, Comparator.comparing(LoA::getLevel).reversed()); }  Long getId(); void setId(Long id); String getName(); void setName(String name); String getDescription(); void setDescription(String description); String getServiceProviderId(); void setServiceProviderId(String serviceProviderId); List<String> getIdentityProviderIds(); void setIdentityProviderIds(List<String> identityProviderIds); List<PdpAttribute> getAttributes(); void setAttributes(List<PdpAttribute> attributes); List<LoA> getLoas(); void setLoas(List<LoA> loas); String getDenyAdvice(); void setDenyAdvice(String denyAdvice); boolean isDenyRule(); void setDenyRule(boolean denyRule); boolean isAllAttributesMustMatch(); void setAllAttributesMustMatch(boolean allAttributesMustMatch); String getPolicyId(); String getServiceProviderName(); void setServiceProviderName(String serviceProviderName); boolean isServiceProviderInvalidOrMissing(); void setServiceProviderInvalidOrMissing(boolean serviceProviderInvalidOrMissing); List<String> getIdentityProviderNames(); void setIdentityProviderNames(List<String> identityProviderNames); List<String> getIdentityProviderNamesNl(); void setIdentityProviderNamesNl(List<String> identityProviderNamesNl); int getNumberOfViolations(); void setNumberOfViolations(int numberOfViolations); void setDenyAdviceNl(String denyAdviceNl); String getDenyAdviceNl(); int getNumberOfRevisions(); void setNumberOfRevisions(int numberOfRevisions); String getClientId(); void setClientId(String clientId); @JsonProperty Date getCreated(); @JsonIgnore void setCreated(Date created); String getUserDisplayName(); void setUserDisplayName(String userDisplayName); void setRevisionNbr(int revisionNbr); int getRevisionNbr(); boolean isActivatedSr(); void setActivatedSr(boolean activatedSr); boolean isActive(); void setActive(boolean active); boolean isActionsAllowed(); void setActionsAllowed(boolean actionsAllowed); String getAuthenticatingAuthorityName(); void setAuthenticatingAuthorityName(String authenticatingAuthorityName); void setType(String type); String getType(); Long getParentId(); void setParentId(Long parentId); @JsonIgnore List<String> anyIdentityProviders(); @JsonIgnore Set<Map.Entry<String, List<PdpAttribute>>> allAttributesGrouped(); @JsonIgnore boolean isIdpOnly(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static PdpPolicyDefinition policyDefinition(String serviceProviderId, List<String> identityProvidersIds); @JsonIgnore void sortLoas(); void setServiceProviderNameNl(String serviceProviderNameNl); String getServiceProviderNameNl();  }
@Test public void sortLoas() throws IOException { PdpPolicyDefinition policyDefinition = getPdpPolicyDefinition(); policyDefinition.getLoas().addAll(Arrays.asList(getLoa("level1"), getLoa("level2"), getLoa("level3"))); policyDefinition.sortLoas(); List<LoA> loas = policyDefinition.getLoas(); assertEquals("level3", loas.get(0).getLevel()); assertEquals("level2", loas.get(1).getLevel()); assertEquals("level1", loas.get(2).getLevel()); }