Directly return list of funds helpers from retrieveAllFunds()

This commit is contained in:
Mohammed Nafees
2014-12-03 12:21:49 +05:30
parent a51390ae37
commit d0f214c834
2 changed files with 8 additions and 9 deletions
@@ -8,7 +8,6 @@ package org.mifosplatform.integrationtests;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertEquals;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import org.junit.Assert;
import org.junit.Before;
@@ -69,13 +68,10 @@ public class FundsIntegrationTest {
final Long fundID = createFund(jsonData, this.requestSpec, this.responseSpec);
Assert.assertNotNull(fundID);
List<HashMap<String, Object>> list = FundsResourceHandler.retrieveAllFunds(this.requestSpec, this.responseSpec);
List<FundsHelper> fhList = FundsResourceHandler.retrieveAllFunds(this.requestSpec, this.responseSpec);
Assert.assertNotNull(list);
Assert.assertThat(list.size(), greaterThanOrEqualTo(1));
jsonData = new Gson().toJson(list);
List<FundsHelper> fhList = new Gson().fromJson(jsonData, new TypeToken<List<FundsHelper>>(){}.getType());
Assert.assertNotNull(fhList);
Assert.assertThat(fhList.size(), greaterThanOrEqualTo(1));
Assert.assertThat(fhList, hasItem(fh));
}
@@ -5,6 +5,7 @@
*/
package org.mifosplatform.integrationtests.common.funds;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
@@ -24,10 +25,12 @@ public class FundsResourceHandler {
return Utils.performServerPost(requestSpec, responseSpec, CREATE_FUNDS_URL, fundJSON, "resourceId");
}
public static List<HashMap<String, Object>> retrieveAllFunds(final RequestSpecification requestSpec,
public static List<FundsHelper> retrieveAllFunds(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
final String URL = FUNDS_URL + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, URL, "");
List<HashMap<String, Object>> list = Utils.performServerGet(requestSpec, responseSpec, URL, "");
String jsonData = new Gson().toJson(list);
return new Gson().fromJson(jsonData, new TypeToken<List<FundsHelper>>(){}.getType());
}
public static String retrieveFund(final Long fundID,