### Question:
BreakpointInterceptor implements Interceptor.Connect, Interceptor.Fetch { @IntRange(from = -1) long getExactContentLengthRangeFrom0(@NonNull DownloadConnection.Connected connected) { final String contentRangeField = connected.getResponseHeaderField(CONTENT_RANGE); long contentLength = -1; if (!Util.isEmpty(contentRangeField)) { final long rightRange = getRangeRightFromContentRange(contentRangeField); if (rightRange > 0) contentLength = rightRange + 1; } if (contentLength < 0) { final String contentLengthField = connected.getResponseHeaderField(CONTENT_LENGTH); if (!Util.isEmpty(contentLengthField)) { contentLength = Long.parseLong(contentLengthField); } } return contentLength; }  @NonNull @Override DownloadConnection.Connected interceptConnect(DownloadChain chain); @Override long interceptFetch(DownloadChain chain);  }### Answer:
@Test public void getExactContentLength_contentRange() { when(connected.getResponseHeaderField(CONTENT_RANGE)).thenReturn("bytes 0-111/222"); assertThat(interceptor.getExactContentLengthRangeFrom0(connected)).isEqualTo(112L); }
@Test public void getExactContentLength_contentLength() { when(connected.getResponseHeaderField(CONTENT_LENGTH)).thenReturn("123"); assertThat(interceptor.getExactContentLengthRangeFrom0(connected)).isEqualTo(123L); }