From cb639f864815f8dfd7dbbd0f21fd4ad08b7db8cc Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Thu, 25 Sep 2014 13:48:35 +0200 Subject: SONAR-5644 Rework SCM API --- .../src/main/java/org/sonar/xoo/XooPlugin.java | 4 +- .../java/org/sonar/xoo/lang/XooScmProvider.java | 102 -------------------- .../main/java/org/sonar/xoo/lang/package-info.java | 23 +++++ .../org/sonar/xoo/rule/OneIssuePerLineSensor.java | 2 +- .../java/org/sonar/xoo/scm/XooBlameCommand.java | 82 ++++++++++++++++ .../java/org/sonar/xoo/scm/XooScmProvider.java | 43 +++++++++ .../main/java/org/sonar/xoo/scm/package-info.java | 23 +++++ .../src/test/java/org/sonar/xoo/XooPluginTest.java | 2 +- .../sonar/xoo/rule/OneIssuePerLineSensorTest.java | 104 +++++++++++++++++++++ .../org/sonar/xoo/scm/XooBlameCommandTest.java | 75 +++++++++++++++ 10 files changed, 355 insertions(+), 105 deletions(-) delete mode 100644 plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/XooScmProvider.java create mode 100644 plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/package-info.java create mode 100644 plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/XooBlameCommand.java create mode 100644 plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/XooScmProvider.java create mode 100644 plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/package-info.java create mode 100644 plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/OneIssuePerLineSensorTest.java create mode 100644 plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/scm/XooBlameCommandTest.java (limited to 'plugins/sonar-xoo-plugin') diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java index e1988ac37ab..148a6df0b7c 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java @@ -25,13 +25,14 @@ import org.sonar.xoo.lang.MeasureSensor; import org.sonar.xoo.lang.SymbolReferencesSensor; import org.sonar.xoo.lang.SyntaxHighlightingSensor; import org.sonar.xoo.lang.TestCaseSensor; -import org.sonar.xoo.lang.XooScmProvider; import org.sonar.xoo.lang.XooTokenizerSensor; import org.sonar.xoo.rule.CreateIssueByInternalKeySensor; import org.sonar.xoo.rule.OneIssueOnDirPerFileSensor; import org.sonar.xoo.rule.OneIssuePerLineSensor; import org.sonar.xoo.rule.XooQualityProfile; import org.sonar.xoo.rule.XooRulesDefinition; +import org.sonar.xoo.scm.XooBlameCommand; +import org.sonar.xoo.scm.XooScmProvider; import java.util.Arrays; import java.util.List; @@ -53,6 +54,7 @@ public class XooPlugin extends SonarPlugin { // SCM XooScmProvider.class, + XooBlameCommand.class, // sensors MeasureSensor.class, diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/XooScmProvider.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/XooScmProvider.java deleted file mode 100644 index 895d47dfbbe..00000000000 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/XooScmProvider.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.xoo.lang; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Charsets; -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.sonar.api.batch.fs.InputFile; -import org.sonar.api.batch.scm.BlameLine; -import org.sonar.api.batch.scm.ScmProvider; -import org.sonar.api.config.Settings; -import org.sonar.api.utils.DateUtils; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -public class XooScmProvider implements ScmProvider { - - private static final Logger LOG = LoggerFactory.getLogger(XooScmProvider.class); - - private static final String SCM_EXTENSION = ".scm"; - - private final Settings settings; - - public XooScmProvider(Settings settings) { - this.settings = settings; - } - - @Override - public String key() { - return "xoo"; - } - - @Override - public boolean supports(File baseDir) { - return false; - } - - @Override - public void blame(Iterable files, BlameResult handler) { - for (InputFile inputFile : files) { - processFile(inputFile, handler); - } - } - - @VisibleForTesting - protected void processFile(InputFile inputFile, BlameResult handler) { - File ioFile = inputFile.file(); - File scmDataFile = new java.io.File(ioFile.getParentFile(), ioFile.getName() + SCM_EXTENSION); - if (!scmDataFile.exists()) { - throw new IllegalStateException("Missing file " + scmDataFile); - } - - try { - List lines = FileUtils.readLines(scmDataFile, Charsets.UTF_8.name()); - List blame = new ArrayList(lines.size()); - int lineNumber = 0; - for (String line : lines) { - lineNumber++; - if (StringUtils.isNotBlank(line)) { - // revision,author,dateTime - String[] fields = StringUtils.split(line, ','); - if (fields.length < 3) { - throw new IllegalStateException("Not enough fields on line " + lineNumber); - } - String revision = fields[0]; - String author = fields[1]; - // Will throw an exception, when date is not in format "yyyy-MM-dd" - Date date = DateUtils.parseDate(fields[2]); - - blame.add(new BlameLine(date, revision, author)); - } - } - handler.add(inputFile, blame); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } -} diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/package-info.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/package-info.java new file mode 100644 index 00000000000..9963cc34bd9 --- /dev/null +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/lang/package-info.java @@ -0,0 +1,23 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +@ParametersAreNonnullByDefault +package org.sonar.xoo.lang; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/OneIssuePerLineSensor.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/OneIssuePerLineSensor.java index 7a11c639e38..31db08c01f2 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/OneIssuePerLineSensor.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/OneIssuePerLineSensor.java @@ -32,7 +32,7 @@ public class OneIssuePerLineSensor implements Sensor { public static final String RULE_KEY = "OneIssuePerLine"; private static final String EFFORT_TO_FIX_PROPERTY = "sonar.oneIssuePerLine.effortToFix"; - private static final String FORCE_SEVERITY_PROPERTY = "sonar.oneIssuePerLine.forceSeverity"; + public static final String FORCE_SEVERITY_PROPERTY = "sonar.oneIssuePerLine.forceSeverity"; @Override public void describe(SensorDescriptor descriptor) { diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/XooBlameCommand.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/XooBlameCommand.java new file mode 100644 index 00000000000..7d492cc315b --- /dev/null +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/XooBlameCommand.java @@ -0,0 +1,82 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.xoo.scm; + +import com.google.common.annotations.VisibleForTesting; +import com.google.common.base.Charsets; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang.StringUtils; +import org.sonar.api.batch.fs.FileSystem; +import org.sonar.api.batch.fs.InputFile; +import org.sonar.api.batch.scm.BlameCommand; +import org.sonar.api.batch.scm.BlameLine; +import org.sonar.api.utils.DateUtils; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class XooBlameCommand implements BlameCommand { + + private static final String SCM_EXTENSION = ".scm"; + + @Override + public void blame(FileSystem fs, Iterable files, BlameResult result) { + for (InputFile inputFile : files) { + processFile(inputFile, result); + } + } + + @VisibleForTesting + protected void processFile(InputFile inputFile, BlameResult result) { + File ioFile = inputFile.file(); + File scmDataFile = new java.io.File(ioFile.getParentFile(), ioFile.getName() + SCM_EXTENSION); + if (!scmDataFile.exists()) { + throw new IllegalStateException("Missing file " + scmDataFile); + } + + try { + List lines = FileUtils.readLines(scmDataFile, Charsets.UTF_8.name()); + List blame = new ArrayList(lines.size()); + int lineNumber = 0; + for (String line : lines) { + lineNumber++; + if (StringUtils.isNotBlank(line)) { + // revision,author,dateTime + String[] fields = StringUtils.split(line, ','); + if (fields.length < 3) { + throw new IllegalStateException("Not enough fields on line " + lineNumber); + } + String revision = fields[0]; + String author = fields[1]; + // Will throw an exception, when date is not in format "yyyy-MM-dd" + Date date = DateUtils.parseDate(fields[2]); + + blame.add(new BlameLine(date, revision, author)); + } + } + result.add(inputFile, blame); + } catch (IOException e) { + throw new IllegalStateException(e); + } + } +} diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/XooScmProvider.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/XooScmProvider.java new file mode 100644 index 00000000000..5807d820043 --- /dev/null +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/XooScmProvider.java @@ -0,0 +1,43 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.xoo.scm; + +import org.sonar.api.batch.scm.BlameCommand; +import org.sonar.api.batch.scm.ScmProvider; + +public class XooScmProvider extends ScmProvider { + + private final XooBlameCommand blame; + + public XooScmProvider(XooBlameCommand blame) { + this.blame = blame; + } + + @Override + public String key() { + return "xoo"; + } + + @Override + public BlameCommand blameCommand() { + return blame; + } + +} diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/package-info.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/package-info.java new file mode 100644 index 00000000000..f5c68e3c563 --- /dev/null +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/package-info.java @@ -0,0 +1,23 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +@ParametersAreNonnullByDefault +package org.sonar.xoo.scm; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/XooPluginTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/XooPluginTest.java index 96ea0ea923c..e8100740345 100644 --- a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/XooPluginTest.java +++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/XooPluginTest.java @@ -27,6 +27,6 @@ public class XooPluginTest { @Test public void provide_extensions() { - assertThat(new XooPlugin().getExtensions()).hasSize(13); + assertThat(new XooPlugin().getExtensions()).hasSize(14); } } diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/OneIssuePerLineSensorTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/OneIssuePerLineSensorTest.java new file mode 100644 index 00000000000..31d109e3653 --- /dev/null +++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/OneIssuePerLineSensorTest.java @@ -0,0 +1,104 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.xoo.rule; + +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; +import org.sonar.api.batch.fs.internal.DefaultFileSystem; +import org.sonar.api.batch.fs.internal.DefaultInputFile; +import org.sonar.api.batch.sensor.SensorContext; +import org.sonar.api.batch.sensor.SensorStorage; +import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; +import org.sonar.api.batch.sensor.issue.Issue; +import org.sonar.api.batch.sensor.issue.Issue.Severity; +import org.sonar.api.batch.sensor.issue.internal.DefaultIssue; +import org.sonar.api.config.Settings; +import org.sonar.xoo.Xoo; + +import static org.fest.assertions.Assertions.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class OneIssuePerLineSensorTest { + + private OneIssuePerLineSensor sensor = new OneIssuePerLineSensor(); + + @Test + public void testDescriptor() { + DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor(); + sensor.describe(descriptor); + assertThat(descriptor.ruleRepositories()).containsOnly(XooRulesDefinition.XOO_REPOSITORY); + } + + @Test + public void testRule() { + DefaultFileSystem fs = new DefaultFileSystem(); + DefaultInputFile inputFile = new DefaultInputFile("foo", "src/Foo.xoo").setLanguage(Xoo.KEY).setLines(10); + fs.add(inputFile); + + SensorContext context = mock(SensorContext.class); + final SensorStorage sensorStorage = mock(SensorStorage.class); + when(context.settings()).thenReturn(new Settings()); + when(context.fileSystem()).thenReturn(fs); + when(context.newIssue()).thenAnswer(new Answer() { + @Override + public Issue answer(InvocationOnMock invocation) throws Throwable { + return new DefaultIssue(sensorStorage); + } + }); + sensor.execute(context); + + ArgumentCaptor argCaptor = ArgumentCaptor.forClass(DefaultIssue.class); + verify(sensorStorage, times(10)).store(argCaptor.capture()); + assertThat(argCaptor.getAllValues()).hasSize(10); // One issue per line + assertThat(argCaptor.getValue().overridenSeverity()).isNull(); + } + + @Test + public void testForceSeverity() { + DefaultFileSystem fs = new DefaultFileSystem(); + DefaultInputFile inputFile = new DefaultInputFile("foo", "src/Foo.xoo").setLanguage(Xoo.KEY).setLines(10); + fs.add(inputFile); + + SensorContext context = mock(SensorContext.class); + final SensorStorage sensorStorage = mock(SensorStorage.class); + Settings settings = new Settings(); + settings.setProperty(OneIssuePerLineSensor.FORCE_SEVERITY_PROPERTY, "MINOR"); + when(context.settings()).thenReturn(settings); + when(context.fileSystem()).thenReturn(fs); + when(context.newIssue()).thenAnswer(new Answer() { + @Override + public Issue answer(InvocationOnMock invocation) throws Throwable { + return new DefaultIssue(sensorStorage); + } + }); + sensor.execute(context); + + ArgumentCaptor argCaptor = ArgumentCaptor.forClass(DefaultIssue.class); + verify(sensorStorage, times(10)).store(argCaptor.capture()); + assertThat(argCaptor.getAllValues()).hasSize(10); // One issue per line + assertThat(argCaptor.getValue().overridenSeverity()).isEqualTo(Severity.MINOR); + } + +} diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/scm/XooBlameCommandTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/scm/XooBlameCommandTest.java new file mode 100644 index 00000000000..bba495dd400 --- /dev/null +++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/scm/XooBlameCommandTest.java @@ -0,0 +1,75 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.xoo.scm; + +import org.apache.commons.io.FileUtils; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.rules.TemporaryFolder; +import org.sonar.api.batch.fs.InputFile; +import org.sonar.api.batch.fs.internal.DefaultFileSystem; +import org.sonar.api.batch.fs.internal.DefaultInputFile; +import org.sonar.api.batch.scm.BlameCommand.BlameResult; +import org.sonar.api.batch.scm.BlameLine; +import org.sonar.api.utils.DateUtils; +import org.sonar.xoo.Xoo; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +public class XooBlameCommandTest { + + @Rule + public TemporaryFolder temp = new TemporaryFolder(); + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + private DefaultFileSystem fs; + private File baseDir; + + @Before + public void prepare() throws IOException { + baseDir = temp.newFolder(); + fs = new DefaultFileSystem(); + } + + @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").setAbsolutePath(new File(baseDir, "src/foo.xoo").getAbsolutePath()).setLanguage(Xoo.KEY); + fs.add(inputFile); + + BlameResult result = mock(BlameResult.class); + new XooBlameCommand().blame(fs, Arrays.asList(inputFile), result); + verify(result).add(inputFile, Arrays.asList(new BlameLine(DateUtils.parseDate("2014-12-12"), "123", "julien"), + new BlameLine(DateUtils.parseDate("2014-12-24"), "234", "julien"))); + } + +} -- cgit v1.2.3