package de.fau.osr.vcs.impl;

import static org.junit.Assert.*;

import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import org.junit.Test;

import com.google.common.collect.Lists;

import de.fau.osr.PublicTestData;
import de.fau.osr.bl.Tracker;
import de.fau.osr.core.db.CSVFileDataSource;
import de.fau.osr.core.db.DataSource;
import de.fau.osr.core.vcs.interfaces.VcsClient.AnnotatedLine;
import de.fau.osr.core.vcs.impl.GitVcsClient;
import de.fau.osr.util.parser.CommitMessageParser;

public class GitBlameTest {
	GitVcsClient client;
	
	public GitBlameTest() throws IOException {
		client =  new GitVcsClient(PublicTestData.getGitTestRepo());
	}
	
	@Test
	public void getBlame() throws Exception {
		Path repoFilePath = Paths.get(new File(PublicTestData.getGitTestRepo()).getAbsolutePath());
		Path dataSrcFilePath= repoFilePath.getParent().resolve("dataSource.csv");
		DataSource dataSource = new CSVFileDataSource(dataSrcFilePath.toFile());
		Tracker tracker = new Tracker(client);
		DataSource dataSrc = new CSVFileDataSource(dataSrcFilePath.toFile());
		List<AnnotatedLine> blame = client.blame("TestFile4", new CommitMessageParser());
		assertEquals(Collections.singletonList(new AnnotatedLine(Lists.<String>newArrayList("1"), "File 4")), Lists.newArrayList(blame));
		blame = client.blame("LICENSE", new CommitMessageParser());
		for(AnnotatedLine line : blame) {
			assertEquals(Collections.emptyList(), line.getRequirements());
		}
	}
}

@@ -77,120 +77,15 @@
 .io.
-File;%0Aimport java.io.IOException;%0Aimport java.nio.file.Path;%0Aimport java.nio.file.Paths;%0Aimport java.util.Collec
+IOExcep
 tion
@@ -243,121 +243,8 @@
 ta;%0A
-import de.fau.osr.bl.Tracker;%0Aimport de.fau.osr.core.db.CSVFileDataSource;%0Aimport de.fau.osr.core.db.DataSource;%0A
 impo
@@ -571,16 +571,16 @@
 %0A%09@Test%0A
+
 %09public 
@@ -618,366 +618,8 @@
 n %7B%0A
-%09%09Path repoFilePath = Paths.get(new File(PublicTestData.getGitTestRepo()).getAbsolutePath());%0A%09%09Path dataSrcFilePath= repoFilePath.getParent().resolve(%22dataSource.csv%22);%0A%09%09DataSource dataSource = new CSVFileDataSource(dataSrcFilePath.toFile());%0A%09%09Tracker tracker = new Tracker(client);%0A%09%09DataSource dataSrc = new CSVFileDataSource(dataSrcFilePath.toFile());%0A
 %09%09Li

clean up BlameTest