@Test public void testProcessDataRelationTypeMatchBothMatch() throws OseeCoreException { IRelationType relationType = CoreRelationTypes.Default_Hierarchical__Child; XRelationType relationTypeRef = MockModel.createXRelationType(relationType.getGuid(), relationType.getName()); RelationTypeRestriction restriction = MockModel.createRelationTypeRestriction(); restriction.setPermission(AccessPermissionEnum.ALLOW); restriction.setRelationTypeRef(relationTypeRef); restriction.setRestrictedToSide(XRelationSideEnum.BOTH); RelationType testRelationType = getTestRelationType( relationType, CoreArtifactTypes.SoftwareRequirement, CoreArtifactTypes.Artifact); IArtifactType artTypeToken1 = CoreArtifactTypes.SoftwareRequirement; ArtifactType artArtType = new ArtifactType(artTypeToken1.getGuid(), artTypeToken1.getName(), false); Set<ArtifactType> superTypes = new HashSet<>(); superTypes.add( new ArtifactType( CoreArtifactTypes.Artifact.getGuid(), CoreArtifactTypes.Artifact.getName(), false)); artArtType.setSuperTypes(superTypes); MockArtifactProxy artData = new MockArtifactProxy( GUID.create(), artArtType, null, null, Collections.singleton(testRelationType)); RelationTypeSide expectedObject1 = new RelationTypeSide(testRelationType, RelationSide.SIDE_A); RelationTypeSide expectedObject2 = new RelationTypeSide(testRelationType, RelationSide.SIDE_B); final List<AccessDetail<?>> actualAccesses = new ArrayList<>(); AccessDetailCollector collector = new AccessDetailCollector() { @Override public void collect(AccessDetail<?> accessDetail) { Assert.assertNotNull(accessDetail); actualAccesses.add(accessDetail); } }; Scope expectedScope = new Scope(); getRestrictionHandler().process(restriction, artData, collector, expectedScope); AccessDetail<?> actualAccess = actualAccesses.get(0); Assert.assertEquals(actualAccess.getPermission(), PermissionEnum.WRITE); Assert.assertEquals(expectedObject1, actualAccess.getAccessObject()); actualAccess = actualAccesses.get(1); Assert.assertEquals(actualAccess.getPermission(), PermissionEnum.WRITE); Assert.assertEquals(expectedObject2, actualAccess.getAccessObject()); }