public void validate(AlmSettingDto almSettingDto) {
    String bitbucketUrl = almSettingDto.getUrl();
    String bitbucketToken = almSettingDto.getDecryptedPersonalAccessToken(encryption);
    if (bitbucketUrl == null || bitbucketToken == null) {
      throw new IllegalArgumentException("Your global Bitbucket Server configuration is incomplete.");
    }

    bitbucketServerRestClient.validateUrl(bitbucketUrl);
    bitbucketServerRestClient.validateToken(bitbucketUrl, bitbucketToken);
    bitbucketServerRestClient.validateReadPermission(bitbucketUrl, bitbucketToken);
  }
@Test
  public void validate_success() {
    AlmSettingDto almSettingDto = createNewBitbucketDto("http://abc.com", "abc");
    when(encryption.isEncrypted(any())).thenReturn(false);

    underTest.validate(almSettingDto);

    verify(bitbucketServerRestClient, times(1)).validateUrl("http://abc.com");
    verify(bitbucketServerRestClient, times(1)).validateToken("http://abc.com", "abc");
    verify(bitbucketServerRestClient, times(1)).validateReadPermission("http://abc.com", "abc");
  }