public static String encodeCredentials(ALM alm, String pat, @Nullable String username) {
    if (!alm.equals(BITBUCKET_CLOUD)) {
      return pat;
    }

    return Base64.getEncoder().encodeToString((username + ":" + pat).getBytes(UTF_8));
  }
@Test
  public void encodes_credential_returns_username_and_encoded_pat_for_bitbucketcloud() {
    String encodedPat = Base64.getEncoder().encodeToString((USERNAME + ":" + PAT).getBytes(UTF_8));

    String encodedCredential = CredentialsEncoderHelper.encodeCredentials(ALM.BITBUCKET_CLOUD, PAT, USERNAME);
    assertThat(encodedCredential)
      .doesNotContain(USERNAME)
      .doesNotContain(PAT)
      .contains(encodedPat);
  }