src/test/java/org/jenkinsci/plugins/pretestedintegrationmercurial/MercurialTest.java
public void testShouldMarkBuildsAsNotBuilt() throws Exception {
		setup();
		File dir = createTempDirectory();
		MercurialBridge plugin = new MercurialBridge(false,"test","default");
		plugin.setWorkingDirectory(new FilePath(dir));

		hg(dir,"init");
		shell(dir,"touch","foo");
		hg(dir,"add","foo");
		hg(dir, "commit","-m","\"added foo\"");
		//String rev = hg(dir,"tip","--template","{node}").toString();
		hg(dir, "branch","test");
		shell(dir,"touch","bar");
		hg(dir, "add","bar");
		hg(dir, "commit","-m","\"added bar\"");
		
		MercurialSCM scm = new MercurialSCM(null,dir.getAbsolutePath(),"test",null,null,null, true);
		FreeStyleProject project = Hudson.getInstance().createProject(FreeStyleProject.class, "testproject");
		project.setScm(scm);
		project.getBuildWrappersList().add(new PretestedIntegrationBuildWrapper(plugin));

		Future<FreeStyleBuild> f = project.scheduleBuild2(0);
		FreeStyleBuild build = f.get();
		assertEquals(Result.SUCCESS,build.getResult());
		f = project.scheduleBuild2(0);
		build = f.get();
		assertEquals(Result.NOT_BUILT, build.getResult());
		f = project.scheduleBuild2(0);
		build = f.get();
		assertEquals(Result.NOT_BUILT, build.getResult());
		cleanup(dir);
	}
/**
	 * When a build is marked as NOT_BUILD
	 * And more builds are started
	 * And there are no changes
	 * Then all following builds should also be marked NOT_BUILD
	 */
When a build is marked as NOT_BUILD
And more builds are started
And there are no changes
Then all following builds should also be marked NOT_BUILD
When a build is marked as NOT_BUILD And more builds are started And there are no changes Then all following builds should also be marked NOT_BUILD
public void testShouldMarkBuildsAsNotBuilt() throws Exception {
		setup();
		File dir = createTempDirectory();
		MercurialBridge plugin = new MercurialBridge(false,"test","default");
		plugin.setWorkingDirectory(new FilePath(dir));
		hg(dir,"init");
		shell(dir,"touch","foo");
		hg(dir,"add","foo");
		hg(dir, "commit","-m","\"added foo\"");
		hg(dir, "branch","test");
		shell(dir,"touch","bar");
		hg(dir, "add","bar");
		hg(dir, "commit","-m","\"added bar\"");
		MercurialSCM scm = new MercurialSCM(null,dir.getAbsolutePath(),"test",null,null,null, true);
		FreeStyleProject project = Hudson.getInstance().createProject(FreeStyleProject.class, "testproject");
		project.setScm(scm);
		project.getBuildWrappersList().add(new PretestedIntegrationBuildWrapper(plugin));
		Future<FreeStyleBuild> f = project.scheduleBuild2(0);
		FreeStyleBuild build = f.get();
		assertEquals(Result.SUCCESS,build.getResult());
		f = project.scheduleBuild2(0);
		build = f.get();
		assertEquals(Result.NOT_BUILT, build.getResult());
		f = project.scheduleBuild2(0);
		build = f.get();
		assertEquals(Result.NOT_BUILT, build.getResult());
		cleanup(dir);
	}
public void testShouldMarkBuildsAsNotBuilt ( ) throws Exception { setup ( ) ; File dir = createTempDirectory ( ) ; MercurialBridge plugin = new MercurialBridge ( false , "test" , "default" ) ; plugin . setWorkingDirectory ( new FilePath ( dir ) ) ; hg ( dir , "init" ) ; shell ( dir , "touch" , "foo" ) ; hg ( dir , "add" , "foo" ) ; hg ( dir , "commit" , "-m" , "\"added foo\"" ) ; hg ( dir , "branch" , "test" ) ; shell ( dir , "touch" , "bar" ) ; hg ( dir , "add" , "bar" ) ; hg ( dir , "commit" , "-m" , "\"added bar\"" ) ; MercurialSCM scm = new MercurialSCM ( null , dir . getAbsolutePath ( ) , "test" , null , null , null , true ) ; FreeStyleProject project = Hudson . getInstance ( ) . createProject ( FreeStyleProject . class , "testproject" ) ; project . setScm ( scm ) ; project . getBuildWrappersList ( ) . add ( new PretestedIntegrationBuildWrapper ( plugin ) ) ; Future < FreeStyleBuild > f = project . scheduleBuild2 ( 0 ) ; FreeStyleBuild build = f . get ( ) ; assertEquals ( Result . SUCCESS , build . getResult ( ) ) ; f = project . scheduleBuild2 ( 0 ) ; build = f . get ( ) ; assertEquals ( Result . NOT_BUILT , build . getResult ( ) ) ; f = project . scheduleBuild2 ( 0 ) ; build = f . get ( ) ; assertEquals ( Result . NOT_BUILT , build . getResult ( ) ) ; cleanup ( dir ) ; }
When a build is marked as NOT_BUILD
 And more builds are started
 And there are no changes
 Then all following builds should also be marked NOT_BUILD
When a build is marked as NOT_BUILD And more builds are started And there are no changes Then all following builds should also be marked NOT_BUILD
//String rev = hg(dir,"tip","--template","{node}").toString();