@Override
  protected InputStream openObjectInputStream(
      long position, int bytesToRead) throws IOException {
    ObsObject object;
    try {
      GetObjectRequest getObjectRequest = new GetObjectRequest(mBucketName, mPath);
      getObjectRequest.setRangeStart(position);
      getObjectRequest.setRangeEnd(position + bytesToRead - 1);
      object = mClient.getObject(getObjectRequest);
    } catch (ObsException e) {
      String errorMessage = String
          .format("Failed to get object: %s bucket: %s", mPath, mBucketName);
      throw new IOException(errorMessage, e);
    }
    return object.getObjectContent();
  }
@Test
  public void openObjectInputStream() throws Exception {
    ObsObject object = Mockito.mock(ObsObject.class);
    InputStream inputStream = Mockito.mock(InputStream.class);
    Mockito.when(mClient.getObject(ArgumentMatchers.any(
        GetObjectRequest.class))).thenReturn(object);
    Mockito.when(object.getObjectContent()).thenReturn(inputStream);

    // test successful open object input stream
    long position = 0L;
    int bytesToRead = 10;
    Object objectInputStream = mOBSPositionReader.openObjectInputStream(position, bytesToRead);
    Assert.assertTrue(objectInputStream instanceof InputStream);

    // test open object input stream with exception
    Mockito.when(mClient.getObject(ArgumentMatchers.any(GetObjectRequest.class)))
        .thenThrow(ObsException.class);
    try {
      mOBSPositionReader.openObjectInputStream(position, bytesToRead);
    } catch (Exception e) {
      Assert.assertTrue(e instanceof IOException);
      String errorMessage = String
          .format("Failed to get object: %s bucket: %s", mPath, mBucketName);
      Assert.assertEquals(errorMessage, e.getMessage());
    }
  }