@Test(expectedExceptions = IllegalStateException.class) public void shouldRequireComputeGraphCall() throws Exception { // Given PolicyGraph graph = new PolicyGraph(RESOURCE_SET); // When graph.isValid(); }
@Test public void shouldDetectValidRights() throws Exception { // Given List<Resource> policies = VALID_POLICIES; PolicyGraph graph = makePolicyGraph(policies); // When graph.computeGraph(); // Then assertThat(graph.isValid()).isTrue(); }
/* VIEW scope is accessible to Dave, so his VIEW reshare to Ed should be active, not inactive. */ @Test public void shouldDetectInvalidRightsTree() 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); // When graph.computeGraph(); // Then assertThat(graph.isValid()).isFalse(); }