comparison test/org/tmatesoft/hg/test/TestCheckout.java @ 536:2813a26b8999

Tests: refactor various utility methods to a single location
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 05 Feb 2013 16:36:58 +0100
parents 47b7bedf0569
children ca56a36c2eea
comparison
equal deleted inserted replaced
535:d9c07e1432c4 536:2813a26b8999
15 * contact TMate Software at support@hg4j.com 15 * contact TMate Software at support@hg4j.com
16 */ 16 */
17 package org.tmatesoft.hg.test; 17 package org.tmatesoft.hg.test;
18 18
19 import static org.junit.Assert.assertEquals; 19 import static org.junit.Assert.assertEquals;
20 import static org.tmatesoft.hg.test.RepoUtils.cloneRepoToTempLocation;
20 21
21 import java.io.File; 22 import java.io.File;
22 import java.io.FileFilter; 23 import java.io.FileFilter;
23 24
24 import org.junit.Assert; 25 import org.junit.Assert;
45 private ExecHelper eh; 46 private ExecHelper eh;
46 47
47 48
48 @Test 49 @Test
49 public void testCleanCheckoutInEmptyDir() throws Exception { 50 public void testCleanCheckoutInEmptyDir() throws Exception {
50 File testRepoLoc = TestRevert.cloneRepoToTempLocation(Configuration.get().find("log-1"), "test-checkoutClean", true); 51 File testRepoLoc = cloneRepoToTempLocation("log-1", "test-checkoutClean", true);
51 repo = new HgLookup().detect(testRepoLoc); 52 repo = new HgLookup().detect(testRepoLoc);
52 // nothing but .hg dir 53 // nothing but .hg dir
53 assertEquals("[sanity]", 0, testRepoLoc.listFiles(new FilesOnlyFilter()).length); 54 assertEquals("[sanity]", 0, testRepoLoc.listFiles(new FilesOnlyFilter()).length);
54 55
55 new HgCheckoutCommand(repo).changeset(1).execute(); 56 new HgCheckoutCommand(repo).changeset(1).execute();
81 Assert.fail("Make sure WC is cleared prior to clean checkout"); 82 Assert.fail("Make sure WC is cleared prior to clean checkout");
82 } 83 }
83 84
84 @Test 85 @Test
85 public void testBranchCheckout() throws Exception { 86 public void testBranchCheckout() throws Exception {
86 File testRepoLoc = TestRevert.cloneRepoToTempLocation(Configuration.get().find("log-branches"), "test-checkoutBranch", true); 87 File testRepoLoc = cloneRepoToTempLocation("log-branches", "test-checkoutBranch", true);
87 repo = new HgLookup().detect(testRepoLoc); 88 repo = new HgLookup().detect(testRepoLoc);
88 89
89 new HgCheckoutCommand(repo).changeset(3 /*branch test*/).execute(); 90 new HgCheckoutCommand(repo).changeset(3 /*branch test*/).execute();
90 91
91 StatusOutputParser statusOutputParser = new StatusOutputParser(); 92 StatusOutputParser statusOutputParser = new StatusOutputParser();