@Test
public void testGetSha1ToCheckOrNull() {

    final String a = B2TestHelpers.makeSha1(1);
    final String b = B2TestHelpers.makeSha1(2);
    final String unverifiedA = "unverified:" + a;
    // range == null, so it's *possible* to check the sha1.
    assertEquals(null, getSha1ToCheckOrNull(makeHeaders(null, null, null)));
    assertEquals(a, getSha1ToCheckOrNull(makeHeaders(null, null, a)));
    assertEquals(a, getSha1ToCheckOrNull(makeHeaders(null, a, null)));
    assertEquals(a, getSha1ToCheckOrNull(makeHeaders(null, unverifiedA, null)));
    assertEquals(a, getSha1ToCheckOrNull(makeHeaders(null, a, b)));  // we prefer the 'small file' sha1 today.
    assertEquals(b, getSha1ToCheckOrNull(makeHeaders(null, "none", b)));  // we need to ignore the "none" that the server sends for large files.
    assertEquals(null, getSha1ToCheckOrNull(makeHeaders(null, "none", null)));  // we need to ignore the "none" that the server sends for large files.
    // range != null, so it's NOT to check the sha1.
    final B2ByteRange contentRange = B2ByteRange.startAt(2);
    assertEquals(null, getSha1ToCheckOrNull(makeHeaders(contentRange, null, null)));
    assertEquals(null, getSha1ToCheckOrNull(makeHeaders(contentRange, null, a)));
    assertEquals(null, getSha1ToCheckOrNull(makeHeaders(contentRange, a, null)));
    assertEquals(null, getSha1ToCheckOrNull(makeHeaders(contentRange, unverifiedA, null)));
    assertEquals(null, getSha1ToCheckOrNull(makeHeaders(contentRange, a, b)));
}