// Path: src/test/java/net/joelinn/asana/test/BaseTest.java
// public abstract class BaseTest {
//     protected String getApiKey(){
//         return "";  //enter your api key here to run the tests
//     }
// }
// 
// Path: src/main/java/net/joelinn/asana/workspaces/Workspaces.java
// @JsonRootName("data")
// public class Workspaces extends ArrayList<Workspace>{
// 
// }
// 
// Path: src/main/java/net/joelinn/asana/workspaces/WorkspacesClient.java
// public class WorkspacesClient extends AbstractClient{
//     public WorkspacesClient(String apiKey) {
//         super(apiKey);
//     }
// 
//     /**
//      * @param apiKey            your Asana API key
//      * @param connectionTimeout the connection timeout in MILLISECONDS
//      * @param readTimeout       the read timeout in MILLISECONDS
//      */
//     public WorkspacesClient(String apiKey, int connectionTimeout, int readTimeout) {
//         super(apiKey, connectionTimeout, readTimeout);
//     }
// 
//     /**
//      * Retrieve all workspaces visible by the user associated with the current api key
//      * @return a list of Workspace objects
//      */
//     public Workspaces getWorkspaces(){
//         return get("").getEntity(Workspaces.class);
//     }
// 
//     /**
//      * Change the name of a workspace
//      * @param workspaceId the id of the workspace to alter
//      * @param name the new name for the workspace
//      * @return a Workspace object
//      */
//     public Workspace updateWorkspace(long workspaceId, String name){
//         MultivaluedMapImpl params = new MultivaluedMapImpl();
//         params.add("name", name);
//         ClientResponse clientResponse = put(Long.toString(workspaceId), params);
//         if(clientResponse.getClientResponseStatus().getStatusCode() == ClientResponse.Status.FORBIDDEN.getStatusCode()){
//             throw new ForbiddenException(clientResponse.getEntity(Errors.class).get(0).message);
//         }
//         return clientResponse.getEntity(Workspace.class);
//     }
// 
//     public Users getUsers(long workspaceId){
//         return get(String.format("%s/users", workspaceId)).getEntity(Users.class);
//     }
// 
//     public Tasks getTasks(long workspaceId, long assigneeId){
//         return getTasks(workspaceId, assigneeId, null);
//     }
// 
//     public Tasks getTasks(long workspaceId, long assigneeId, Long projectId){
//         return getTasks(workspaceId, assigneeId, projectId, false);
//     }
// 
//     public Tasks getTasks(long workspaceId, long assigneeId, Long projectId, boolean include_archived){
//         MultivaluedMapImpl params = new MultivaluedMapImpl();
//         params.add("assignee", assigneeId);
//         params.add("include_archived", include_archived);
//         if(projectId != null){
//             params.add("project", projectId);
//         }
//         return get(String.format("%s/tasks", workspaceId), params).getEntity(Tasks.class);
//     }
// 
//     public Projects getProjects(long workspaceId){
//         return getProjects(workspaceId, false);
//     }
// 
//     public Projects getProjects(long workspaceId, boolean archived){
//         MultivaluedMapImpl params = new MultivaluedMapImpl();
//         params.add("archived", archived);
//         return get(String.format("%s/projects", workspaceId), params).getEntity(Projects.class);
//     }
// 
//     public Tags getTags(long workspaceId){
//         return get(String.format("%s/tags", workspaceId)).getEntity(Tags.class);
//     }
// 
//     @Override
//     protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data) {
//         return super.request(method, "workspaces/" + url, queryParams, data);
//     }
// }


import net.joelinn.asana.test.BaseTest;
import net.joelinn.asana.workspaces.Workspaces;
import net.joelinn.asana.workspaces.WorkspacesClient;
import org.junit.Before;
import org.junit.Test;
package net.joelinn.asana.test.workspaces;


/**
 * Joe Linn
 * 11/17/13
 */
public class WorkspacesClientTest extends BaseTest{
    protected WorkspacesClient client;

    @Before
    public void setUp(){
        client = new WorkspacesClient(getApiKey());
    }

    @Test
    public void testGetWorkspaces(){
        if(getApiKey().equals("")){
            // skip the test if no api key has been provided
            return;
        }
// Path: src/test/java/net/joelinn/asana/test/BaseTest.java
// public abstract class BaseTest {
//     protected String getApiKey(){
//         return "";  //enter your api key here to run the tests
//     }
// }
// 
// Path: src/main/java/net/joelinn/asana/workspaces/Workspaces.java
// @JsonRootName("data")
// public class Workspaces extends ArrayList<Workspace>{
// 
// }
// 
// Path: src/main/java/net/joelinn/asana/workspaces/WorkspacesClient.java
// public class WorkspacesClient extends AbstractClient{
//     public WorkspacesClient(String apiKey) {
//         super(apiKey);
//     }
// 
//     /**
//      * @param apiKey            your Asana API key
//      * @param connectionTimeout the connection timeout in MILLISECONDS
//      * @param readTimeout       the read timeout in MILLISECONDS
//      */
//     public WorkspacesClient(String apiKey, int connectionTimeout, int readTimeout) {
//         super(apiKey, connectionTimeout, readTimeout);
//     }
// 
//     /**
//      * Retrieve all workspaces visible by the user associated with the current api key
//      * @return a list of Workspace objects
//      */
//     public Workspaces getWorkspaces(){
//         return get("").getEntity(Workspaces.class);
//     }
// 
//     /**
//      * Change the name of a workspace
//      * @param workspaceId the id of the workspace to alter
//      * @param name the new name for the workspace
//      * @return a Workspace object
//      */
//     public Workspace updateWorkspace(long workspaceId, String name){
//         MultivaluedMapImpl params = new MultivaluedMapImpl();
//         params.add("name", name);
//         ClientResponse clientResponse = put(Long.toString(workspaceId), params);
//         if(clientResponse.getClientResponseStatus().getStatusCode() == ClientResponse.Status.FORBIDDEN.getStatusCode()){
//             throw new ForbiddenException(clientResponse.getEntity(Errors.class).get(0).message);
//         }
//         return clientResponse.getEntity(Workspace.class);
//     }
// 
//     public Users getUsers(long workspaceId){
//         return get(String.format("%s/users", workspaceId)).getEntity(Users.class);
//     }
// 
//     public Tasks getTasks(long workspaceId, long assigneeId){
//         return getTasks(workspaceId, assigneeId, null);
//     }
// 
//     public Tasks getTasks(long workspaceId, long assigneeId, Long projectId){
//         return getTasks(workspaceId, assigneeId, projectId, false);
//     }
// 
//     public Tasks getTasks(long workspaceId, long assigneeId, Long projectId, boolean include_archived){
//         MultivaluedMapImpl params = new MultivaluedMapImpl();
//         params.add("assignee", assigneeId);
//         params.add("include_archived", include_archived);
//         if(projectId != null){
//             params.add("project", projectId);
//         }
//         return get(String.format("%s/tasks", workspaceId), params).getEntity(Tasks.class);
//     }
// 
//     public Projects getProjects(long workspaceId){
//         return getProjects(workspaceId, false);
//     }
// 
//     public Projects getProjects(long workspaceId, boolean archived){
//         MultivaluedMapImpl params = new MultivaluedMapImpl();
//         params.add("archived", archived);
//         return get(String.format("%s/projects", workspaceId), params).getEntity(Projects.class);
//     }
// 
//     public Tags getTags(long workspaceId){
//         return get(String.format("%s/tags", workspaceId)).getEntity(Tags.class);
//     }
// 
//     @Override
//     protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data) {
//         return super.request(method, "workspaces/" + url, queryParams, data);
//     }
// }


// Path: src/test/java/net/joelinn/asana/test/workspaces/WorkspacesClientTest.java
import net.joelinn.asana.test.BaseTest;
import net.joelinn.asana.workspaces.Workspaces;
import net.joelinn.asana.workspaces.WorkspacesClient;
import org.junit.Before;
import org.junit.Test;

package net.joelinn.asana.test.workspaces;


/**
 * Joe Linn
 * 11/17/13
 */
public class WorkspacesClientTest extends BaseTest{
    protected WorkspacesClient client;

    @Before
    public void setUp(){
        client = new WorkspacesClient(getApiKey());
    }

    @Test
    public void testGetWorkspaces(){
        if(getApiKey().equals("")){
            // skip the test if no api key has been provided
            return;
        }
        Workspaces workspaces = client.getWorkspaces();