@Test
public void testCreateBucket() throws B2Exception {

    final Map<String, String> bucketInfo = B2Collections.mapOf(
            "one", "1",
            "two", "2"
    );
    final List<B2LifecycleRule> lifecycleRules = listOf(
            B2LifecycleRule.builder(FILE_PREFIX).build()
    );
    final B2CreateBucketRequest request = B2CreateBucketRequest
            .builder(BUCKET_NAME, BUCKET_TYPE)
            .setBucketInfo(bucketInfo)
            .setLifecycleRules(lifecycleRules)
            .build();
    final B2Bucket bucket = new B2Bucket(
            ACCOUNT_ID,
            bucketId(1),
            BUCKET_NAME,
            BUCKET_TYPE,
            bucketInfo,
            new ArrayList<>(),
            lifecycleRules,
            Collections.emptySet(),
            1);
    B2CreateBucketRequestReal expectedRequest = new B2CreateBucketRequestReal(ACCOUNT_ID, request);
    when(webifier.createBucket(ACCOUNT_AUTH, expectedRequest)).thenReturn(bucket);
    final B2Bucket response = client.createBucket(request);
    assertEquals(bucket, response);
    retryer.assertCallCountIs(2); // auth + createBucket.
    // for coverage
    //noinspection ResultOfMethodCallIgnored
    request.hashCode();
    //noinspection ResultOfMethodCallIgnored
    expectedRequest.hashCode();
    // for coverage
    assertEquals(bucket(1), bucket(1));
    //noinspection ResultOfMethodCallIgnored
    bucket.hashCode();
    assertEquals("B2Bucket(bucket1,allPublic,bucket1,2 infos,0 corsRules,1 lifecycleRules,0 options,v1)", bucket.toString());
    final B2Bucket bucketWithOptions = new B2Bucket(
            ACCOUNT_ID,
            bucketId(1),
            BUCKET_NAME,
            BUCKET_TYPE,
            bucketInfo,
            new ArrayList<>(),
            lifecycleRules,
            B2TestHelpers.makeBucketOrApplicationKeyOptions(),
            1);
    assertEquals("B2Bucket(bucket1,allPublic,bucket1,2 infos,0 corsRules,1 lifecycleRules,[myOption1, myOption2] options,v1)",
            bucketWithOptions.toString());
}