@Test
  public void getVariablesWithAuthenticatedTenant() {
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));

    Map<String, Object> variables = caseService.getVariables(caseExecutionId);

    assertThat(variables, notNullValue());
    assertThat(variables.keySet(), hasItem(VARIABLE_NAME));
  }
  @Test
  public void getVariablesNoAuthenticatedTenants() {
    identityService.setAuthentication("user", null, null);

    thrown.expect(ProcessEngineException.class);
    thrown.expectMessage("Cannot get the case execution");

    caseService.getVariables(caseExecutionId);
  }
  @Test
  public void getVariablesDisabledTenantCheck() {
    identityService.setAuthentication("user", null, null);
    processEngineConfiguration.setTenantCheckEnabled(false);

    Map<String, Object> variables = caseService.getVariables(caseExecutionId);

    assertThat(variables, notNullValue());
    assertThat(variables.keySet(), hasItem(VARIABLE_NAME));
  }
  @Test
  public void removeVariablesWithAuthenticatedTenant() {
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));

    caseService.removeVariable(caseExecutionId, VARIABLE_NAME);

    identityService.clearAuthentication();

    Map<String, Object> variables = caseService.getVariables(caseExecutionId);
    assertThat(variables.isEmpty(), is(true));
  }
  @Test
  public void removeVariablesDisabledTenantCheck() {
    identityService.setAuthentication("user", null, null);
    processEngineConfiguration.setTenantCheckEnabled(false);

    caseService.removeVariable(caseExecutionId, VARIABLE_NAME);

    identityService.clearAuthentication();

    Map<String, Object> variables = caseService.getVariables(caseExecutionId);
    assertThat(variables.isEmpty(), is(true));
  }