@Test public void testBlame() throws IOException { File source = new File(baseDir, "src/foo.xoo"); FileUtils.write(source, "sample content"); File scm = new File(baseDir, "src/foo.xoo.scm"); FileUtils.write(scm, "123,julien,2014-12-12\n234,julien,2014-12-24"); DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setLanguage(Xoo.KEY); fs.add(inputFile); BlameOutput result = mock(BlameOutput.class); when(input.filesToBlame()).thenReturn(Arrays.<InputFile>asList(inputFile)); new XooBlameCommand().blame(input, result); verify(result) .blameResult( inputFile, Arrays.asList( new BlameLine() .revision("123") .author("julien") .date(DateUtils.parseDate("2014-12-12")), new BlameLine() .revision("234") .author("julien") .date(DateUtils.parseDate("2014-12-24")))); }
@Before public void prepare() throws IOException { baseDir = temp.newFolder(); fs = new DefaultFileSystem(baseDir.toPath()); input = mock(BlameInput.class); when(input.fileSystem()).thenReturn(fs); }