private String getUrlContent(CachedUrl url) throws IOException {
   InputStream content = url.getUnfilteredInputStream();
   ByteArrayOutputStream baos = new ByteArrayOutputStream();
   StreamUtil.copy(content, baos);
   content.close();
   String contentStr = new String(baos.toByteArray());
   baos.close();
   return contentStr;
 }
  public void testStoreOverwrite() throws Exception {
    AuState auState =
        new AuState(
            mau,
            123, // lastCrawlTime
            321, // lastCrawlAttempt
            -1, // lastCrawlResult
            null, // lastCrawlResultMsg,
            321, // lastTopLevelPoll
            333, // lastPollStart
            -1, // lastPollresult
            null, // lastPollresultMsg
            0, // pollDuration
            -1, // lastTreeWalk
            null, // crawlUrls
            null, // accessType
            1, // clockssSubscriptionState
            1.0, // v3Agreement
            1.0, // highestV3Agreement
            SubstanceChecker.State.Unknown,
            null, // substanceVersion
            null, // metadataVersion
            -1, // lastMetadataIndex
            0, // lastContentChange
            444, // lastPoPPoll
            8, // lastPoPPollResult
            -1, // lastLocalHashScan
            27, // numAgreePeersLastPoR
            72, // numWillingRepirers
            19, // numCurrentSuspectVersions
            ListUtil.list("http://foo/"), // cdnStems
            repository);

    repository.storeAuState(auState);
    String filePath = LockssRepositoryImpl.mapAuToFileLocation(tempDirPath, mau);
    filePath += HistoryRepositoryImpl.AU_FILE_NAME;
    File xmlFile = new File(filePath);
    FileInputStream fis = new FileInputStream(xmlFile);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    StreamUtil.copy(fis, baos);
    fis.close();
    String expectedStr = baos.toString();

    auState =
        new AuState(
            mau,
            1234, // lastCrawlTime
            4321, // lastCrawlAttempt
            -1, // lastCrawlResult
            null, // lastCrawlResultMsg,
            4321, // lastTopLevelPoll
            5555, // lastPollStart
            -1, // lastPollresult
            null, // lastPollresultMsg
            0, // pollDuration
            -1, // lastTreeWalk
            null, // crawlUrls
            null, // accessType
            1, // clockssSubscriptionState
            1.0, // v3Agreement
            1.0, // highestV3Agreement
            SubstanceChecker.State.Unknown,
            null, // substanceVersion
            null, // metadataVersion
            -1, // lastMetadataIndex
            0, // lastContentChange
            -1, // lastPoPPoll
            -1, // lastPoPPollResult
            -1, // lastLocalHashScan
            13, // numAgreePeersLastPoR
            31, // numWillingRepairers
            91, // numCurrentSuspectVersions
            ListUtil.list("http://foo/"), // cdnStems
            repository);
    repository.storeAuState(auState);
    assertEquals(1234, auState.getLastCrawlTime());
    assertEquals(4321, auState.getLastCrawlAttempt());
    assertEquals(4321, auState.getLastTopLevelPollTime());
    assertEquals(5555, auState.getLastPollStart());
    assertEquals(13, auState.getNumAgreePeersLastPoR());
    assertEquals(31, auState.getNumWillingRepairers());
    assertEquals(91, auState.getNumCurrentSuspectVersions());
    assertEquals(mau.getAuId(), auState.getArchivalUnit().getAuId());
    assertEquals(ListUtil.list("http://foo/"), auState.getCdnStems());

    fis = new FileInputStream(xmlFile);
    baos = new ByteArrayOutputStream(expectedStr.length());
    StreamUtil.copy(fis, baos);
    fis.close();
    log.info(baos.toString());

    auState = null;
    auState = repository.loadAuState();
    assertEquals(1234, auState.getLastCrawlTime());
    assertEquals(4321, auState.getLastCrawlAttempt());
    assertEquals(4321, auState.getLastTopLevelPollTime());
    assertEquals(5555, auState.getLastPollStart());
    assertEquals(13, auState.getNumAgreePeersLastPoR());
    assertEquals(31, auState.getNumWillingRepairers());
    assertEquals(91, auState.getNumCurrentSuspectVersions());
    assertEquals(mau.getAuId(), auState.getArchivalUnit().getAuId());

    auState =
        new AuState(
            mau,
            123, // lastCrawlTime
            321, // lastCrawlAttempt
            -1, // lastCrawlResult
            null, // lastCrawlResultMsg,
            321, // lastTopLevelPoll
            333, // lastPollStart
            -1, // lastPollresult
            null, // lastPollresultMsg
            0, // pollDuration
            -1, // lastTreeWalk
            null, // crawlUrls
            null, // accessType
            1, // clockssSubscriptionState
            1.0, // v3Agreement
            1.0, // highestV3Agreement
            SubstanceChecker.State.Unknown,
            null, // substanceVersion
            null, // metadataVersion
            -1, // lastMetadataIndex
            0, // lastContentChange
            444, // lastPoPPoll
            8, // lastPoPPollResult
            -1, // lastLocalHashScan
            27, // numAgreePeersLastPoR
            72, // numWillingRepairers
            19, // numCurrentSuspectVersions
            ListUtil.list("http://foo/"), // cdnStems
            repository);
    repository.storeAuState(auState);
    fis = new FileInputStream(xmlFile);
    baos = new ByteArrayOutputStream(expectedStr.length());
    StreamUtil.copy(fis, baos);
    fis.close();
    assertEquals(expectedStr, baos.toString());
  }