### Question:
CloudStorage { public byte[] get( final String bucket, final String name ) { checkArgument(StringUtils.isNotEmpty(bucket), "`bucket` should not be empty"); checkArgument(StringUtils.isNotEmpty(name), "`name` should not be empty"); final BlobId blobId = BlobId.of(bucket, name); final Blob blob = storage.get(blobId); if (blob == null) { throw new CloudStorageException( String.format("Not found :: blobId=%s", blobId.toString())); } log.info("Downloaded blob info :: blob={}", blob.toString()); final byte[] content; try { content = blob.getContent(Blob.BlobSourceOption.generationMatch()); } catch (StorageException e) { throw new CloudStorageException(e); } log.info("Downloaded blob content :: content-length={}", content.length); return content; } protected  CloudStorage(final GoogleCredentials credentials); protected  CloudStorage(final Storage storage); static CloudStorage fromStream(final InputStream credentialsStream); byte[] get(
        final String bucket,
        final String name
    );  }### Answer:
@Test public void getTest() { final BlobId blobId = BlobId.of("bucket", "name"); when(storage.get(blobId)).thenReturn(blob); when(blob.getContent(Blob.BlobSourceOption.generationMatch())) .thenReturn(new byte[]{0x12, 0x34}); final byte[] content = cloudStorage.get("bucket", "name"); assertArrayEquals(new byte[]{0x12, 0x34}, content); }
@Test public void getTest_emptyBucket() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("`bucket` should not be empty"); cloudStorage.get("", "name"); }
@Test @SuppressWarnings("ConstantConditions") public void getTest_nullBucket() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("`bucket` should not be empty"); cloudStorage.get(null, "name"); }
@Test public void getTest_emptyName() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("`name` should not be empty"); cloudStorage.get("bucket", ""); }
@Test @SuppressWarnings("ConstantConditions") public void getTest_nullName() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("`name` should not be empty"); cloudStorage.get("bucket", null); }
@Test public void getTest_blobNotFound() { expectedException.expect(CloudStorageException.class); expectedException.expectMessage("Not found :: blobId="); final BlobId blobId = BlobId.of("bucket", "name"); when(storage.get(blobId)).thenReturn(null); cloudStorage.get("bucket", "name"); }
@Test public void getTest_storageException() { expectedException.expect(CloudStorageException.class); expectedException.expectCause(instanceOf(StorageException.class)); final BlobId blobId = BlobId.of("bucket", "name"); when(storage.get(blobId)).thenReturn(blob); when(blob.getContent(any())).thenThrow(StorageException.class); cloudStorage.get("bucket", "name"); }