/* Dave had previously re-shared VIEW scope to ED, but that was made invalid when he lost that scope himself. He has been re-granted that scope so the VIEW scope should move the active policy and the empty inactive policy should be deleted. */ @Test public void shouldUpdateInvalidRightsTree() throws Exception { // Given List<Resource> policies = excludePolicies(DAVE, ED); policies.add(makePolicy(DAVE, ED, true, DELETE)); policies.add(makePolicy(DAVE, ED, false, VIEW)); PolicyGraph graph = makePolicyGraph(policies); graph.computeGraph(); given(delegate.updatePolicies(isNull(ServerContext.class), anySet())) .willReturn( Promises.<List<Resource>, ResourceException>newResultPromise( Collections.<Resource>emptyList())); given(delegate.deletePolicies(isNull(ServerContext.class), anySet())) .willReturn( Promises.<List<Resource>, ResourceException>newResultPromise( Collections.<Resource>emptyList())); // When Promise<List<List<Resource>>, ResourceException> promise = graph.update(null, delegate); // Then AssertJPromiseAssert.assertThat(promise).succeeded(); assertThat(UmaPolicyUtils.getPolicyScopes(policyUpdated())).containsOnly(VIEW, DELETE); assertThat(policyDeleted()).isEqualTo("Dave-Ed-false"); verifyNoMoreInteractions(delegate); }