@Test public void shouldSetOrganizationPrimaryOwnerRole() { User user = new User(); user.setId("user-id"); final Role primaryOwnerRole = new Role(); primaryOwnerRole.setId("role-id"); when(membershipService.findByCriteria(eq(ReferenceType.ORGANIZATION), eq(Organization.DEFAULT), any(MembershipCriteria.class))).thenReturn(Flowable.empty()); when(roleService.findSystemRole(SystemRole.ORGANIZATION_PRIMARY_OWNER, ReferenceType.ORGANIZATION)).thenReturn(Maybe.just(primaryOwnerRole)); when(membershipService.addOrUpdate(eq(Organization.DEFAULT), any(Membership.class))).thenReturn(Single.just(new Membership())); cut.setOrganizationPrimaryOwnerRole(user); }
public void setOrganizationPrimaryOwnerRole(User user) { Role adminRole = roleService.findSystemRole(SystemRole.ORGANIZATION_PRIMARY_OWNER, ReferenceType.ORGANIZATION).blockingGet(); setRole(user, adminRole); }
MembershipHelper { public void setOrganizationPrimaryOwnerRole(User user) { Role adminRole = roleService.findSystemRole(SystemRole.ORGANIZATION_PRIMARY_OWNER, ReferenceType.ORGANIZATION).blockingGet(); setRole(user, adminRole); } }
MembershipHelper { public void setOrganizationPrimaryOwnerRole(User user) { Role adminRole = roleService.findSystemRole(SystemRole.ORGANIZATION_PRIMARY_OWNER, ReferenceType.ORGANIZATION).blockingGet(); setRole(user, adminRole); } MembershipHelper(MembershipService membershipService,
                            RoleService roleService); }
MembershipHelper { public void setOrganizationPrimaryOwnerRole(User user) { Role adminRole = roleService.findSystemRole(SystemRole.ORGANIZATION_PRIMARY_OWNER, ReferenceType.ORGANIZATION).blockingGet(); setRole(user, adminRole); } MembershipHelper(MembershipService membershipService,
                            RoleService roleService); void setOrganizationPrimaryOwnerRole(User user); void setRole(User user, Role role); }
MembershipHelper { public void setOrganizationPrimaryOwnerRole(User user) { Role adminRole = roleService.findSystemRole(SystemRole.ORGANIZATION_PRIMARY_OWNER, ReferenceType.ORGANIZATION).blockingGet(); setRole(user, adminRole); } MembershipHelper(MembershipService membershipService,
                            RoleService roleService); void setOrganizationPrimaryOwnerRole(User user); void setRole(User user, Role role);  }