@NonNull
  public GifHeader parseHeader() {
    if (rawData == null) {
      throw new IllegalStateException("You must call setData() before parseHeader()");
    }
    if (err()) {
      return header;
    }

    readHeader();
    if (!err()) {
      readContents();
      if (header.frameCount < 0) {
        header.status = STATUS_FORMAT_ERROR;
      }
    }

    return header;
  }
@Test(expected = IllegalStateException.class)
  public void testThrowsIfParseHeaderCalledBeforeSetData() {
    GifHeaderParser parser = new GifHeaderParser();
    parser.parseHeader();
  }