4040
4141public class BucketTest {
4242
43+ private static final BucketInfo BUCKET_INFO = BucketInfo .of ("b" );
4344 private static final Iterable <BlobInfo > BLOB_INFO_RESULTS = ImmutableList .of (
4445 BlobInfo .of ("b" , "n1" ),
4546 BlobInfo .of ("b" , "n2" ),
4647 BlobInfo .of ("b" , "n3" ));
4748
4849 private Storage storage ;
4950 private Bucket bucket ;
50- private final BucketInfo bucketInfo = BucketInfo .of ("b" );
5151
5252 @ Before
5353 public void setUp () throws Exception {
5454 storage = createStrictMock (Storage .class );
55- bucket = new Bucket (storage , bucketInfo );
55+ bucket = new Bucket (storage , BUCKET_INFO );
5656 }
5757
5858 @ After
@@ -62,27 +62,27 @@ public void tearDown() throws Exception {
6262
6363 @ Test
6464 public void testInfo () throws Exception {
65- assertEquals (bucketInfo , bucket .info ());
65+ assertEquals (BUCKET_INFO , bucket .info ());
6666 replay (storage );
6767 }
6868
6969 @ Test
7070 public void testExists_True () throws Exception {
71- expect (storage .get (bucketInfo .name ())).andReturn (bucketInfo );
71+ expect (storage .get (BUCKET_INFO .name ())).andReturn (BUCKET_INFO );
7272 replay (storage );
7373 assertTrue (bucket .exists ());
7474 }
7575
7676 @ Test
7777 public void testExists_False () throws Exception {
78- expect (storage .get (bucketInfo .name ())).andReturn (null );
78+ expect (storage .get (BUCKET_INFO .name ())).andReturn (null );
7979 replay (storage );
8080 assertFalse (bucket .exists ());
8181 }
8282
8383 @ Test
8484 public void testUpdate () throws Exception {
85- BucketInfo updatedInfo = bucketInfo .toBuilder ().notFoundPage ("p" ).build ();
85+ BucketInfo updatedInfo = BUCKET_INFO .toBuilder ().notFoundPage ("p" ).build ();
8686 expect (storage .update (updatedInfo )).andReturn (updatedInfo );
8787 replay (storage );
8888 bucket .update (updatedInfo );
@@ -92,15 +92,15 @@ public void testUpdate() throws Exception {
9292
9393 @ Test
9494 public void testDelete () throws Exception {
95- expect (storage .delete (bucketInfo .name ())).andReturn (true );
95+ expect (storage .delete (BUCKET_INFO .name ())).andReturn (true );
9696 replay (storage );
9797 assertTrue (bucket .delete ());
9898 }
9999
100100 @ Test
101101 public void testList () throws Exception {
102102 BaseListResult <BlobInfo > blobInfoResult = new BaseListResult <>(null , "c" , BLOB_INFO_RESULTS );
103- expect (storage .list (bucketInfo .name ())).andReturn (blobInfoResult );
103+ expect (storage .list (BUCKET_INFO .name ())).andReturn (blobInfoResult );
104104 replay (storage );
105105 ListResult <Blob > blobResult = bucket .list ();
106106 Iterator <BlobInfo > blobInfoIterator = blobInfoResult .iterator ();
@@ -116,7 +116,7 @@ public void testList() throws Exception {
116116 @ Test
117117 public void testGet () throws Exception {
118118 BlobInfo info = BlobInfo .of ("b" , "n" );
119- expect (storage .get (bucketInfo .name (), "n" )).andReturn (info );
119+ expect (storage .get (BUCKET_INFO .name (), "n" )).andReturn (info );
120120 replay (storage );
121121 Blob blob = bucket .get ("n" );
122122 assertEquals (info , blob .info ());
0 commit comments