src/test/java/org/jenkinsci/plugins/pretestedintegrationmercurial/MercurialIT.java
public void testReset() throws Exception {
		//do some work on a branch that succeeds
		//init branch
		//do 3 commits
		setup();
		File remote = createTempDirectory();
		hg(remote,"init");
		File foo = new File(remote,"foo");
		FileUtils.touch(foo);
		hg(remote,"add","foo");
		
		FreeStyleProject alice = createJob(remote.getAbsolutePath(),"alice","alice","default");
		
		//this one goes fine
		hg(remote, "branch","alice");
		FileUtils.writeStringToFile(foo,"Hello world");
		hg(remote, "commit","-m","Added hello message");
		
		alice.scheduleBuild2(0).get();
		
		//now fail all the resulting builds
		TestBuilder failBuilder = new TestBuilder() {

			@Override
			public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
					BuildListener listener) throws InterruptedException,
					IOException {
				// TODO Auto-generated method stub
				build.setResult(Result.FAILURE);
				return false;
			}	
		};
		
		FileUtils.writeStringToFile(foo, "Helo world");
		hg(remote, "commit","-m","Introduced typo on purpose");
		String badRevision = hg(remote,"tip","--template","{node}").toString();
		
		alice.scheduleBuild2(0);
		
		FileUtils.writeStringToFile(foo, "Hello, world!");
		hg(remote,"commit","-m","Added punctuation");
		
		alice.scheduleBuild2(0);
		
		alice.getBuildWrappersList().remove(PretestedIntegrationBuildWrapper.class);
		
		//now reset the internal pointer
		PretestedIntegrationBuildWrapper buildWrapper = new PretestedIntegrationBuildWrapper(new MercurialBridge(true,"alice","default"));
		alice.getBuildWrappersList().add(buildWrapper);
		
		//TODO: Figure out how to wait for the two builds to terminate
	}
/**
	 * Test that a reset will test and integrate false negatives
	 */
Test that a reset will test and integrate false negatives
Test that a reset will test and integrate false negatives
public void testReset() throws Exception {
		setup();
		File remote = createTempDirectory();
		hg(remote,"init");
		File foo = new File(remote,"foo");
		FileUtils.touch(foo);
		hg(remote,"add","foo");
		FreeStyleProject alice = createJob(remote.getAbsolutePath(),"alice","alice","default");
		hg(remote, "branch","alice");
		FileUtils.writeStringToFile(foo,"Hello world");
		hg(remote, "commit","-m","Added hello message");
		alice.scheduleBuild2(0).get();
		TestBuilder failBuilder = new TestBuilder() {
			@Override
			public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
					BuildListener listener) throws InterruptedException,
					IOException {
				build.setResult(Result.FAILURE);
				return false;
			}	
		};
		FileUtils.writeStringToFile(foo, "Helo world");
		hg(remote, "commit","-m","Introduced typo on purpose");
		String badRevision = hg(remote,"tip","--template","{node}").toString();
		alice.scheduleBuild2(0);
		FileUtils.writeStringToFile(foo, "Hello, world!");
		hg(remote,"commit","-m","Added punctuation");
		alice.scheduleBuild2(0);
		alice.getBuildWrappersList().remove(PretestedIntegrationBuildWrapper.class);
		PretestedIntegrationBuildWrapper buildWrapper = new PretestedIntegrationBuildWrapper(new MercurialBridge(true,"alice","default"));
		alice.getBuildWrappersList().add(buildWrapper);
	}
public void testReset ( ) throws Exception { setup ( ) ; File remote = createTempDirectory ( ) ; hg ( remote , "init" ) ; File foo = new File ( remote , "foo" ) ; FileUtils . touch ( foo ) ; hg ( remote , "add" , "foo" ) ; FreeStyleProject alice = createJob ( remote . getAbsolutePath ( ) , "alice" , "alice" , "default" ) ; hg ( remote , "branch" , "alice" ) ; FileUtils . writeStringToFile ( foo , "Hello world" ) ; hg ( remote , "commit" , "-m" , "Added hello message" ) ; alice . scheduleBuild2 ( 0 ) . get ( ) ; TestBuilder failBuilder = new TestBuilder ( ) { @ Override public boolean perform ( AbstractBuild < ? , ? > build , Launcher launcher , BuildListener listener ) throws InterruptedException , IOException { build . setResult ( Result . FAILURE ) ; return false ; } } ; FileUtils . writeStringToFile ( foo , "Helo world" ) ; hg ( remote , "commit" , "-m" , "Introduced typo on purpose" ) ; String badRevision = hg ( remote , "tip" , "--template" , "{node}" ) . toString ( ) ; alice . scheduleBuild2 ( 0 ) ; FileUtils . writeStringToFile ( foo , "Hello, world!" ) ; hg ( remote , "commit" , "-m" , "Added punctuation" ) ; alice . scheduleBuild2 ( 0 ) ; alice . getBuildWrappersList ( ) . remove ( PretestedIntegrationBuildWrapper . class ) ; PretestedIntegrationBuildWrapper buildWrapper = new PretestedIntegrationBuildWrapper ( new MercurialBridge ( true , "alice" , "default" ) ) ; alice . getBuildWrappersList ( ) . add ( buildWrapper ) ; }
Test that a reset will test and integrate false negatives
Test that a reset will test and integrate false negatives
//do some work on a branch that succeeds //init branch //do 3 commits //this one goes fine //now fail all the resulting builds // TODO Auto-generated method stub //now reset the internal pointer //TODO: Figure out how to wait for the two builds to terminate