ArcIndexProcessor implements PreDepositProcessor { public File process(WctDataExtractor data) { return process(null, data); }  File process(WctDataExtractor data); File process(String tempDirectory, WctDataExtractor data);  }
@Test public void test_cdx_index_created_for_arc_file() throws IOException { Mockery mockContext = new Mockery(); final WctDataExtractor dataExtractor = mockContext.mock(WctDataExtractor.class); final List<ArchiveFile> arcFiles = new ArrayList<ArchiveFile>(); ArchiveFile archive1File = new FileSystemArchiveFile("application/octet-stream", "", TEST_ARC_1, DIRECTORY); arcFiles.add(archive1File); ArchiveFile archive2File = new FileSystemArchiveFile("application/octet-stream", "", TEST_ARC_2, DIRECTORY); arcFiles.add(archive2File); mockContext.checking(new Expectations() { { allowing(dataExtractor).getArchiveFiles(); will(returnValue(arcFiles)); one(dataExtractor).setArcIndexFile(with(any(ArchiveFile.class))); } }); ArcIndexProcessor processor = new ArcIndexProcessor(); File cdxFile = processor.process(tempDirectory, dataExtractor); BufferedReader br = new BufferedReader(new FileReader(cdxFile)); String line = null; int lineCount = 0; br.readLine(); while ((line = br.readLine()) != null) { lineCount++; if (lineCount < 12) assertThat(line, containsString("TestArc1")); else assertThat(line, containsString("TestArc2")); } assertThat(lineCount, is(equalTo(22))); mockContext.assertIsSatisfied(); }