// Path: src/main/java/com/cobalt/bamboo/plugin/pipeline/cdresult/ContributorBuilder.java
// public class ContributorBuilder {
// 	private static final String JIRA_USER_AVATAR_PATH = "/secure/useravatar?ownerId=";
// 	private static final String JIRA_PROFILE_PATH = "/secure/ViewProfile.jspa?name=";
// 	
// 	private String jiraBaseUrl;
// 	
// 	/**
// 	 * Constructs a ContributorBuilder object.
// 	 * 
// 	 * @param jiraApplinksService to connect to Jira via Application Link.
// 	 */
// 	public ContributorBuilder(JiraApplinksService jiraApplinksService){
// 		// User need to make sure they put the JIRA applink as the primary application link to Jira
// 		if(jiraApplinksService == null){
// 			throw new IllegalArgumentException("Arguments can't be null.");
// 		}
//         jiraBaseUrl = null;
// 
//         Iterable<ApplicationLink> appLinkService = jiraApplinksService.getJiraApplicationLinks();
//         if (appLinkService != null || appLinkService.iterator() != null) {
//             Iterator<ApplicationLink> appLinks = jiraApplinksService.getJiraApplicationLinks().iterator();
//             if (appLinks.hasNext()) {
//                 jiraBaseUrl = appLinks.next().getRpcUrl().toString();
//             }
//         }
// 
// 	}
// 	
// 	/**
// 	 * Create a Contributor based on the username, last commit date, and full name.
// 	 * ContributorBuilder will construct the picture url and profile page url using
// 	 * jiraBaseUrl given by the application link.
// 	 * 
// 	 * @param username of the contributor
// 	 * @param lastCommitDate of the contributor
// 	 * @param fullName of the contributor from Bamboo
// 	 * @return the Contributor created. If there are application link to Jira,
// 	 *         Contributor's picture url and profile page url will be set accordingly, 
// 	 *         otherwise, those fields will be null.
// 	 */
// 	public Contributor createContributor(String username, Date lastCommitDate, String fullName){
// 		if (jiraBaseUrl != null) {
// 			String pictureUrl = jiraBaseUrl + JIRA_USER_AVATAR_PATH + username;
// 			String profilePageUrl = jiraBaseUrl + JIRA_PROFILE_PATH + username;
// 			return new Contributor(username, lastCommitDate, fullName, pictureUrl, profilePageUrl);
// 		} else {
// 			return new Contributor(username, lastCommitDate, fullName, null, null);
// 		}
// 	}
// }


import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import com.atlassian.applinks.api.ApplicationLink;
import com.atlassian.bamboo.applinks.JiraApplinksService;
import com.atlassian.bamboo.author.Author;
import com.atlassian.bamboo.commit.Commit;
import com.cobalt.bamboo.plugin.pipeline.cdresult.ContributorBuilder;
package com.cobalt.bamboo.plugin.pipeline.cdperformance;





public class CDPerformanceAddAuthorsTest {
	private static final int COMMIT_LIST_SIZE = 10; // >= 3
	CompletionStats stat; 
// Path: src/main/java/com/cobalt/bamboo/plugin/pipeline/cdresult/ContributorBuilder.java
// public class ContributorBuilder {
// 	private static final String JIRA_USER_AVATAR_PATH = "/secure/useravatar?ownerId=";
// 	private static final String JIRA_PROFILE_PATH = "/secure/ViewProfile.jspa?name=";
// 	
// 	private String jiraBaseUrl;
// 	
// 	/**
// 	 * Constructs a ContributorBuilder object.
// 	 * 
// 	 * @param jiraApplinksService to connect to Jira via Application Link.
// 	 */
// 	public ContributorBuilder(JiraApplinksService jiraApplinksService){
// 		// User need to make sure they put the JIRA applink as the primary application link to Jira
// 		if(jiraApplinksService == null){
// 			throw new IllegalArgumentException("Arguments can't be null.");
// 		}
//         jiraBaseUrl = null;
// 
//         Iterable<ApplicationLink> appLinkService = jiraApplinksService.getJiraApplicationLinks();
//         if (appLinkService != null || appLinkService.iterator() != null) {
//             Iterator<ApplicationLink> appLinks = jiraApplinksService.getJiraApplicationLinks().iterator();
//             if (appLinks.hasNext()) {
//                 jiraBaseUrl = appLinks.next().getRpcUrl().toString();
//             }
//         }
// 
// 	}
// 	
// 	/**
// 	 * Create a Contributor based on the username, last commit date, and full name.
// 	 * ContributorBuilder will construct the picture url and profile page url using
// 	 * jiraBaseUrl given by the application link.
// 	 * 
// 	 * @param username of the contributor
// 	 * @param lastCommitDate of the contributor
// 	 * @param fullName of the contributor from Bamboo
// 	 * @return the Contributor created. If there are application link to Jira,
// 	 *         Contributor's picture url and profile page url will be set accordingly, 
// 	 *         otherwise, those fields will be null.
// 	 */
// 	public Contributor createContributor(String username, Date lastCommitDate, String fullName){
// 		if (jiraBaseUrl != null) {
// 			String pictureUrl = jiraBaseUrl + JIRA_USER_AVATAR_PATH + username;
// 			String profilePageUrl = jiraBaseUrl + JIRA_PROFILE_PATH + username;
// 			return new Contributor(username, lastCommitDate, fullName, pictureUrl, profilePageUrl);
// 		} else {
// 			return new Contributor(username, lastCommitDate, fullName, null, null);
// 		}
// 	}
// }


// Path: src/test/java/com/cobalt/bamboo/plugin/pipeline/cdperformance/CDPerformanceAddAuthorsTest.java
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import com.atlassian.applinks.api.ApplicationLink;
import com.atlassian.bamboo.applinks.JiraApplinksService;
import com.atlassian.bamboo.author.Author;
import com.atlassian.bamboo.commit.Commit;
import com.cobalt.bamboo.plugin.pipeline.cdresult.ContributorBuilder;

package com.cobalt.bamboo.plugin.pipeline.cdperformance;





public class CDPerformanceAddAuthorsTest {
	private static final int COMMIT_LIST_SIZE = 10; // >= 3
	CompletionStats stat; 
	ContributorBuilder cb;