package com.aemreunal.domain.project;

/*
 ***************************
 * Copyright (c) 2014      *
 *                         *
 * This code belongs to:   *
 *                         *
 * @author Ahmet Emre Ünal *
 * S001974                 *
 *                         *
 * aemreunal@gmail.com     *
 * emre.unal@ozu.edu.tr    *
 *                         *
 * aemreunal.com           *
 ***************************
 */

import java.util.ArrayList;
import org.apache.http.HttpStatus;
import com.aemreunal.domain.EntityGetter;
import com.jayway.restassured.path.json.JsonPath;

public class ProjectGetter extends EntityGetter {
    public static ArrayList<ProjectInfo> getAllProjects(String username) {
        JsonPath responseJson = getEntity("/" + username + "/project");
        ArrayList<ProjectInfo> projects = new ArrayList<>();
        for (JsonPath projectJson : responseJson.getList("", JsonPath.class)) {
            projects.add(new ProjectInfo(projectJson, username, ""));
        }
        return projects;
    }

    public static ProjectInfo getProject(String username, Long projectId) {
        JsonPath responseJson = getEntity("/" + username + "/project/" + projectId);
        return new ProjectInfo(responseJson, username, "");
    }

    public static void failToFindProject(String username, Long projectId) {
        // TODO parametrise requests via rest-assured get()/post() Object... parameters
        sendGetRequest("/" + username + "/project/" + projectId, HttpStatus.SC_NOT_FOUND);
    }
}

@@ -445,16 +445,42 @@
 ayList;%0A
+import java.util.HashMap;%0A
 import o
@@ -874,24 +874,23 @@
 or (
-JsonPath
+HashMap
  project
 Json
@@ -885,20 +885,19 @@
  project
-Json
+Map
  : respo
@@ -916,24 +916,23 @@
 ist(%22%22, 
-JsonPath
+HashMap
 .class))
@@ -982,20 +982,19 @@
 (project
-Json
+Map
 , userna

Fix project getter bug