private IBuildQueryResult queryBuilds(final TFSTeamProjectCollection connection,final String buildName,final String teamProject,final BuildStatus status){
  Check.notNull(connection,"connection");
  Check.notNullOrEmpty(buildName,"buildName");
  Check.notNullOrEmpty(teamProject,"teamProject");
  final IBuildServer buildServer=connection.getBuildServer();
  final IBuildDetailSpec buildDetailSpec=buildServer.createBuildDetailSpec(teamProject);
  buildDetailSpec.setBuildNumber(buildName);
  buildDetailSpec.setInformationTypes(new String[]{InformationTypes.CHECK_IN_OUTCOME});
  if (status != null) {
    buildDetailSpec.setStatus(status);
  }
  return buildServer.queryBuilds(buildDetailSpec);
}

private IBuildQueryResult queryBuilds ( final TFSTeamProjectCollection connection , final String buildName , final String teamProject , final BuildStatus status ) { Check . notNull ( connection , "connection" ) ; Check . notNullOrEmpty ( buildName , "buildName" ) ; Check . notNullOrEmpty ( teamProject , "teamProject" ) ; final IBuildServer buildServer = connection . getBuildServer ( ) ; final IBuildDetailSpec buildDetailSpec = buildServer . createBuildDetailSpec ( teamProject ) ; buildDetailSpec . setBuildNumber ( buildName ) ; buildDetailSpec . setInformationTypes ( new String [ ] { InformationTypes . CHECK_IN_OUTCOME } ) ; if ( status != null ) { buildDetailSpec . setStatus ( status ) ; } return buildServer . queryBuilds ( buildDetailSpec ) ; }
queries the server for succeeded or partially succeeded builds which match the given build name and team project .
