Directly return list of funds helpers from retrieveAllFunds()
This commit is contained in:
+3
-7
@@ -8,7 +8,6 @@ package org.mifosplatform.integrationtests;
|
|||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.*;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import com.google.common.reflect.TypeToken;
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -69,13 +68,10 @@ public class FundsIntegrationTest {
|
|||||||
final Long fundID = createFund(jsonData, this.requestSpec, this.responseSpec);
|
final Long fundID = createFund(jsonData, this.requestSpec, this.responseSpec);
|
||||||
Assert.assertNotNull(fundID);
|
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.assertNotNull(fhList);
|
||||||
Assert.assertThat(list.size(), greaterThanOrEqualTo(1));
|
Assert.assertThat(fhList.size(), greaterThanOrEqualTo(1));
|
||||||
|
|
||||||
jsonData = new Gson().toJson(list);
|
|
||||||
List<FundsHelper> fhList = new Gson().fromJson(jsonData, new TypeToken<List<FundsHelper>>(){}.getType());
|
|
||||||
Assert.assertThat(fhList, hasItem(fh));
|
Assert.assertThat(fhList, hasItem(fh));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -5,6 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.mifosplatform.integrationtests.common.funds;
|
package org.mifosplatform.integrationtests.common.funds;
|
||||||
|
|
||||||
|
import com.google.common.reflect.TypeToken;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.jayway.restassured.specification.RequestSpecification;
|
import com.jayway.restassured.specification.RequestSpecification;
|
||||||
import com.jayway.restassured.specification.ResponseSpecification;
|
import com.jayway.restassured.specification.ResponseSpecification;
|
||||||
@@ -24,10 +25,12 @@ public class FundsResourceHandler {
|
|||||||
return Utils.performServerPost(requestSpec, responseSpec, CREATE_FUNDS_URL, fundJSON, "resourceId");
|
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 ResponseSpecification responseSpec) {
|
||||||
final String URL = FUNDS_URL + "?" + Utils.TENANT_IDENTIFIER;
|
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,
|
public static String retrieveFund(final Long fundID,
|
||||||
|
|||||||
Reference in New Issue
Block a user