### Question:
UtilAuthorizationService { public CheckResourceRightsV4Response getResourceRightsResult(CheckResourceRightsV4Request checkResourceRightsV4Request) { String userCrn = ThreadBasedUserCrnProvider.getUserCrn(); List<AuthorizationProto.RightCheck> rightChecks = Lists.newArrayList(); checkResourceRightsV4Request.getResourceRights().stream() .forEach(resourceRightsV4 -> resourceRightsV4.getRights().stream() .forEach(rightV4 -> rightChecks.add(createRightCheckObject(rightV4.getAction().getRight(), resourceRightsV4.getResourceCrn())))); List<Boolean> results = grpcUmsClient.hasRights(userCrn, userCrn, rightChecks, MDCUtils.getRequestId()); return generateResponse(rightChecks, results); }  CheckRightV4Response getRightResult(CheckRightV4Request rightReq); CheckResourceRightsV4Response getResourceRightsResult(CheckResourceRightsV4Request checkResourceRightsV4Request);  }### Answer:
@Test public void testCheckResourceRight() { when(grpcUmsClient.hasRights(anyString(), anyString(), any(), any())) .thenReturn(Lists.newArrayList(Boolean.TRUE, Boolean.FALSE, Boolean.FALSE, Boolean.TRUE)); CheckResourceRightsV4Request rightReq = new CheckResourceRightsV4Request(); rightReq.setResourceRights(Lists.newArrayList(createResourceRightV4("envCrn", RightV4.ENV_STOP, RightV4.ENV_START), createResourceRightV4("dhCrn", RightV4.DH_START, RightV4.DH_STOP))); CheckResourceRightsV4Response rightResult = ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.getResourceRightsResult(rightReq)); rightResult.getResponses().stream().forEach(checkResourceRightV4SingleResponse -> checkResourceRightV4SingleResponse.getRights().stream() .forEach(checkRightV4SingleResponse -> { if (checkRightV4SingleResponse.getRight().equals(RightV4.ENV_STOP) || checkRightV4SingleResponse.getRight().equals(RightV4.DH_STOP)) { assertTrue(checkRightV4SingleResponse.getResult()); } if (checkRightV4SingleResponse.getRight().equals(RightV4.DH_START) || checkRightV4SingleResponse.getRight().equals(RightV4.ENV_START)) { assertFalse(checkRightV4SingleResponse.getResult()); } })); verify(grpcUmsClient, times(1)).hasRights(anyString(), anyString(), any(), any()); }