diff test/org/tmatesoft/hg/test/TestIncoming.java @ 203:66fd2c73c56f

Basic test for HgOutgoingCommand. Handle cases with no outgoing changes in RepositoryComparator
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 26 Apr 2011 15:52:33 +0200
parents 706bcc7cfee4
children 883f1efbcf27
line wrap: on
line diff
--- a/test/org/tmatesoft/hg/test/TestIncoming.java	Tue Apr 26 02:50:06 2011 +0200
+++ b/test/org/tmatesoft/hg/test/TestIncoming.java	Tue Apr 26 15:52:33 2011 +0200
@@ -93,12 +93,12 @@
 		cmd.executeFull(collector);
 		eh.run("hg", "incoming", "--debug", hgRemote.getLocation());
 		List<Nodeid> liteResult = cmd.executeLite(null);
-		report(collector, outParser, liteResult);
+		report(collector, outParser, liteResult, errorCollector);
 		return liteResult;
 	}
 	
-	private void report(HgLogCommand.CollectHandler collector, LogOutputParser outParser, List<Nodeid> liteResult) {
-		TestHistory.report("hg in - against blank repo", collector.getChanges(), outParser.getResult(), false, errorCollector);
+	static void report(HgLogCommand.CollectHandler collector, LogOutputParser outParser, List<Nodeid> liteResult, ErrorCollectorExt errorCollector) {
+		TestHistory.report("hg vs execFull", collector.getChanges(), outParser.getResult(), false, errorCollector);
 		//
 		ArrayList<Nodeid> expected = new ArrayList<Nodeid>(outParser.getResult().size());
 		for (LogOutputParser.Record r : outParser.getResult()) {
@@ -122,13 +122,18 @@
 		}
 		errorCollector.checkThat(what + " Superfluous cset reported by HgIncomingCommand.execLite", set.isEmpty(), equalTo(true));
 	}
-
-	static File initEmptyTempRepo(String dirName) throws IOException {
+	
+	static File createEmptyDir(String dirName) throws IOException {
 		File dest = new File(Configuration.get().getTempDir(), dirName);
 		if (dest.exists()) {
 			TestClone.rmdir(dest);
 		}
 		dest.mkdirs();
+		return dest;
+	}
+
+	static File initEmptyTempRepo(String dirName) throws IOException {
+		File dest = createEmptyDir(dirName);
 		Internals implHelper = new Internals();
 		implHelper.setStorageConfig(1, STORE | FNCACHE | DOTENCODE);
 		implHelper.initEmptyRepository(new File(dest, ".hg"));