public void testDefensiveCopyForCrawlQueue() throws SharepointException {
ListState list = new ListState("{GUID_LIST_1}", "List1", "GenericList",
Calendar.getInstance(), "List",
"http://sharepoint.example.com/List1/AllItems.aspx", null);
List<SPDocument> mutableDocumentList = new ArrayList<SPDocument>();
SPDocument document1 = new SPDocument(
"LIST_ITEM_1", "http://sharepoint.example.com/List1/DispForm.aspx?ID=1",
Calendar.getInstance(), SpiConstants.ActionType.ADD);
mutableDocumentList.add(document1);
list.setCrawlQueue(mutableDocumentList);
// Verify List crawl queue
assertEquals(ImmutableList.of(document1), list.getCrawlQueue());
// Add new document to mutable list
SPDocument document2 = new SPDocument(
"LIST_ITEM_2", "http://sharepoint.example.com/List1/DispForm.aspx?ID=2",
Calendar.getInstance(), SpiConstants.ActionType.ADD);
mutableDocumentList.add(document2);
// Verify List crawl queue is not modified