use of com.sun.identity.entitlement.opensso.PolicyCondition in project OpenAM by OpenRock.
the class JsonPolicyParserTest method shouldAllowLegacyPolicyConditions.
@Test
public void shouldAllowLegacyPolicyConditions() throws Exception {
// Given
List<String> realm = Arrays.asList("REALM");
JsonValue content = buildJson(field("condition", object(field("type", "Policy"), field("className", AuthenticateToRealmCondition.class.getName()), field("properties", object(field("AuthenticateToRealm", realm))))));
// When
Privilege result = parser.parsePolicy(POLICY_NAME, content);
// Then
assertThat(result.getCondition()).isInstanceOf(PolicyCondition.class);
PolicyCondition condition = (PolicyCondition) result.getCondition();
assertThat(condition.getClassName()).isEqualTo(AuthenticateToRealmCondition.class.getName());
assertThat(condition.getProperties()).isEqualTo(Collections.singletonMap("AuthenticateToRealm", new HashSet<String>(realm)));
}
Aggregations