Skip to content

Commit

Permalink
AIT#createAccountShadowQuerySecondaryIdentifier: added not null assert
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed Apr 3, 2020
1 parent 9326220 commit 8076e70
Showing 1 changed file with 8 additions and 2 deletions.
Expand Up @@ -6,6 +6,7 @@
*/
package com.evolveum.midpoint.test;

import static org.assertj.core.api.Assertions.assertThat;
import static org.testng.AssertJUnit.*;

import static com.evolveum.midpoint.test.PredefinedTestMethodTracing.OFF;
Expand Down Expand Up @@ -1309,13 +1310,18 @@ protected ObjectQuery createAccountShadowQuery(String identifier, PrismObject<Re
.build();
}

protected ObjectQuery createAccountShadowQuerySecondaryIdentifier(String identifier, PrismObject<ResourceType> resource) throws SchemaException {
protected ObjectQuery createAccountShadowQuerySecondaryIdentifier(
String identifier, PrismObject<ResourceType> resource) throws SchemaException {
RefinedResourceSchema rSchema = RefinedResourceSchemaImpl.getRefinedSchema(resource);
RefinedObjectClassDefinition rAccount = rSchema.getDefaultRefinedDefinition(ShadowKindType.ACCOUNT);
assertThat(rAccount)
.withFailMessage("No RefinedObjectClassDefinition for %s", rSchema)
.isNotNull();
return createShadowQuerySecondaryIdentifier(rAccount, identifier, resource);
}

protected ObjectQuery createShadowQuerySecondaryIdentifier(ObjectClassComplexTypeDefinition rAccount, String identifier, PrismObject<ResourceType> resource) {
protected ObjectQuery createShadowQuerySecondaryIdentifier(
ObjectClassComplexTypeDefinition rAccount, String identifier, PrismObject<ResourceType> resource) {
Collection<? extends ResourceAttributeDefinition> identifierDefs = rAccount.getSecondaryIdentifiers();
assert identifierDefs.size() == 1 : "Unexpected identifier set in " + resource + " refined schema: " + identifierDefs;
ResourceAttributeDefinition identifierDef = identifierDefs.iterator().next();
Expand Down

0 comments on commit 8076e70

Please sign in to comment.