public BackupUploadDescriptor generateUpload(final String key) {
    if (key.isBlank()) {
      throw new IllegalArgumentException("Upload descriptors must have non-empty keys");
    }
    final String entity = WRITE_ENTITY_PREFIX + key;
    final ExternalServiceCredentials credentials = credentialsGenerator.generateFor(entity);
    final String b64Key = Base64.getEncoder().encodeToString(key.getBytes(StandardCharsets.UTF_8));
    final Map<String, String> headers = Map.of(
        HttpHeaders.AUTHORIZATION, HeaderUtils.basicAuthHeader(credentials),
        "Upload-Metadata", String.format("filename %s", b64Key));

    return new BackupUploadDescriptor(
        BACKUP_CDN,
        key,
        headers,
        tusUri + "/" + CDN_PATH);
  }
@Test
  public void uploadGenerator() {
    Cdn3BackupCredentialGenerator generator = new Cdn3BackupCredentialGenerator(new TusConfiguration(
        new SecretBytes(TestRandomUtil.nextBytes(32)),
        "https://example.org/upload"));

    final BackupUploadDescriptor messageBackupUploadDescriptor = generator.generateUpload("subdir/key");
    assertThat(messageBackupUploadDescriptor.signedUploadLocation()).isEqualTo("https://example.org/upload/backups");
    assertThat(messageBackupUploadDescriptor.key()).isEqualTo("subdir/key");
    assertThat(messageBackupUploadDescriptor.headers()).containsKey("Authorization");
    final String username = parseUsername(messageBackupUploadDescriptor.headers().get("Authorization"));
    assertThat(username).isEqualTo("write$backups/subdir/key");
  }