Show answerHide answer
Correct answer: A
CONDITION: (claim: entity.Claim) return claim.Segment == null
ACTION: (claim: entity.Claim, actions: gw.rules.Action) claim.Segment = TC_AUTO_LOW; actions.exit()
Explanation
Answer Option (Which option is correct) A. CONDITION: (claim: entity.Claim) return claim.Segment == nullACTION: (claim: entity.Claim, actions: gw.rules.Action) claim.Segment = TC_AUTO_LOW; actions.exit()
Explanation:
The rule condition returns a boolean and checks whether the claim segment is unset. The action assigns the desired segment and calls the rule action API. Keep the comparison in the condition and the assignment in the action; compare exit behavior with the target rules API when the requirement specifically says to leave the ruleset.
Verification note: The selected rule calls actions.exit(), but the stem specifically says to leave the ruleset. Verify the distinction between exit and exitToNext/exitRuleset against the target rules API.
Why the other options are incorrect:
B. CONDITION: (claim: entity.Claim) if (claim.Segment == null) {claim.Segment = TC_AUTO_LOW}
ACTION: actions.exit():
The condition contains a state assignment. A condition should decide whether the action applies. The mutation belongs in the action.
C. CONDITION: (claim: entity.Claim) return claim.Segment == null
ACTION: (claim: entity.Claim, actions: gw.rules.Action) claim.Segment == TC_AUTO_LOW; actions.exitRuleset():
The action uses equality comparison instead of assignment. It therefore does not set the segment. The exit call cannot repair that missing update.
D. CONDITION: (claim: entity.Claim) return claim.Segment = TC_AUTO_LOW
ACTION: (claim: entity.Claim, actions: gw.rules.Action) actions.exit():
The condition assigns a segment instead of testing the unset state. It does not return the intended predicate. The rule separates the eligibility test from its mutation.
References:
Guidewire-authored PolicyCenter 10.1.2 - Rules and validation signatures
Gosu language project - Operators, loops, functions, and properties