### Question:
CloudStorage { public static CloudStorage fromStream(final InputStream credentialsStream) { Objects.requireNonNull(credentialsStream); final GoogleCredentials credentials; try { credentials = GoogleCredentials.fromStream(credentialsStream) .createScoped(List.of("https: } catch (IOException e) { throw new CloudStorageException(e); } return new CloudStorage(credentials); } 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 fromStreamTest() throws IOException { expectedException.expect(CloudStorageException.class); expectedException.expectCause(instanceOf(IOException.class)); final InputStream inputStream = mock(InputStream.class); when(inputStream.read()).thenThrow(IOException.class); when(inputStream.read(any(byte[].class))).thenThrow(IOException.class); when(inputStream.read(any(byte[].class), anyInt(), anyInt())).thenThrow(IOException.class); CloudStorage.fromStream(inputStream); }