LogStorageInfos { @VisibleForTesting static Optional<S3Account> parseS3AccessPointArn(String s3AccessPointArn) { String trimmed = StringExt.safeTrim(s3AccessPointArn); if (trimmed.isEmpty()) { return Optional.empty(); } Matcher matcher = S3_ACCESS_POINT_ARN_RE.matcher(s3AccessPointArn); if (!matcher.matches()) { return Optional.empty(); } return Optional.of(new S3Account(matcher.group(2), matcher.group(1))); }  static Map<String, String> toS3LogLocationTaskContext(Job<E> job); static S3LogLocation buildLogLocation(Task task, S3LogLocation defaultLogLocation); static Optional<S3Bucket> findCustomS3Bucket(Job<?> job); static Optional<S3Bucket> findCustomS3Bucket(JobDescriptor<?> jobDescriptor); static Optional<S3Bucket> findCustomS3Bucket(Task task); static Optional<String> findCustomPathPrefix(JobDescriptor<?> jobDescriptor); static Optional<String> findCustomPathPrefix(Task task); static String buildPathPrefix(String first, String second);  }
@Test public void testParseS3AccessPointArn() { assertThat(LogStorageInfos.parseS3AccessPointArn("myBucket")).isEmpty(); assertThat(LogStorageInfos.parseS3AccessPointArn("arn:aws:s3:us-west-2:123456789012:accesspoint/test")).contains( new S3Account("123456789012", "us-west-2") ); assertThat(LogStorageInfos.parseS3AccessPointArn("arn:aws:ec2:us-west-2:123456789012:accesspoint/test")).isEmpty(); }