### Question:
StorageServiceImpl implements StorageService { @Override public SignedUrl createSignedUrl(String fileID, String authorizationToken, String partitionID) { log.debug("Creating the signed blob for fileID : {}. Authorization : {}, partitionID : {}", fileID, authorizationToken, partitionID); Instant now = Instant.now(Clock.systemUTC()); String bucketName = getBucketName(partitionID); String userDesID = getUserDesID(authorizationToken); String filepath = getFileLocationPrefix(now, fileID, userDesID); log.debug("Create storage object for fileID {} in bucket {} with filepath {}", fileID, bucketName, filepath); if (filepath.length() > StorageConstant.GCS_MAX_FILEPATH) { throw new BadRequestException(format( "The maximum filepath length is %s characters, but got a name with %s characters", StorageConstant.GCS_MAX_FILEPATH, filepath.length())); } SignedObject signedObject = storageRepository.createSignedObject(bucketName, filepath); return SignedUrl.builder() .url(signedObject.getUrl()) .uri(signedObject.getUri()) .createdBy(userDesID) .createdAt(now) .build(); }  @Override SignedUrl createSignedUrl(String fileID, String authorizationToken, String partitionID);  }### Answer:
@Test void shouldCreateObjectSignedUrl() { SignedObject signedObject = getSignedObject(); given(storageRepository.createSignedObject(eq(TestUtils.BUCKET_NAME), anyString())).willReturn(signedObject); SignedUrl signedUrl = storageService.createSignedUrl( TestUtils.FILE_ID, TestUtils.AUTHORIZATION_TOKEN, TestUtils.PARTITION); then(signedUrl).satisfies(url -> { then(url.getUrl().toString()).is(TestUtils.GCS_URL_CONDITION); then(url.getUri().toString()).matches(TestUtils.GCS_OBJECT_URI); then(url.getCreatedAt()).isBefore(now()); then(url.getCreatedBy()).isEqualTo(TestUtils.USER_DES_ID); }); verify(storageRepository).createSignedObject(eq(TestUtils.BUCKET_NAME), filenameCaptor.capture()); then(filenameCaptor.getValue()).matches(TestUtils.USER_DES_ID + ".*?" + TestUtils.UUID_REGEX); }
@Test void shouldThrowExceptionWhenResultFilepathIsMoreThan1024Characters() { String fileId = RandomStringUtils.randomAlphanumeric(1024); Throwable thrown = catchThrowable(() -> storageService.createSignedUrl(fileId, TestUtils.AUTHORIZATION_TOKEN, TestUtils.PARTITION)); then(thrown) .isInstanceOf(BadRequestException.class) .hasMessageContaining("The maximum filepath length is 1024 characters"); verify(storageRepository, never()).createSignedObject(anyString(), anyString()); }