public GithubAppConfiguration validate(AlmSettingDto almSettingDto) {
    return validate(almSettingDto.getAppId(), almSettingDto.getClientId(), almSettingDto.getClientSecret(), almSettingDto.getPrivateKey(), almSettingDto.getUrl());
  }
@Test
  public void github_global_settings_validation_with_encrypted_key() {
    String encryptedKey = "encrypted-key";
    String decryptedKey = "decrypted-key";
    AlmSettingDto almSettingDto = createNewGithubDto("clientId", "clientSecret", EXAMPLE_APP_ID, encryptedKey);

    when(encryption.isEncrypted(encryptedKey)).thenReturn(true);
    when(encryption.decrypt(encryptedKey)).thenReturn(decryptedKey);

    GithubAppConfiguration configuration = underTest.validate(almSettingDto);

    ArgumentCaptor<GithubAppConfiguration> configurationArgumentCaptor = ArgumentCaptor.forClass(GithubAppConfiguration.class);
    verify(appClient).checkApiEndpoint(configurationArgumentCaptor.capture());
    verify(appClient).checkAppPermissions(configurationArgumentCaptor.capture());
    assertThat(configuration.getId()).isEqualTo(configurationArgumentCaptor.getAllValues().get(0).getId());
    assertThat(decryptedKey).isEqualTo(configurationArgumentCaptor.getAllValues().get(0).getPrivateKey());
    assertThat(configuration.getId()).isEqualTo(configurationArgumentCaptor.getAllValues().get(1).getId());
    assertThat(decryptedKey).isEqualTo(configurationArgumentCaptor.getAllValues().get(1).getPrivateKey());
  }