コード例 #1
0
  @Test
  public void testInitiateMultipartUpload() {
    ObjectCreation objectCreation =
        new ObjectCreation()
            .withStorageClass(StorageClass.REDUCED_REDUNDANCY)
            .withContentType("test/aaa")
            .withExpires("xyz");

    InitiateMultipartUploadResult expected = mock(InitiateMultipartUploadResult.class);

    when(invoker.invoke(
            Request.builder()
                .method(Method.POST)
                .endpoint(endpoint)
                .bucket(bucket)
                .key(key)
                .subResource("uploads")
                .header("x-snda-storage-class", "REDUCED_REDUNDANCY")
                .header("Content-Type", "test/aaa")
                .header("Expires", "xyz")
                .header("Date", HttpDateTimeFormatter.formatDateTime(now))
                .build(),
            InitiateMultipartUploadResult.class))
        .thenReturn(expected);

    InitiateMultipartUploadResult actual =
        client.initiateMultipartUpload(bucket, key, objectCreation);
    assertSame(expected, actual);
  }