FINERACT-984: Test improvements to not rely on database storage ordering and some database independent query implementations
This commit is contained in:
committed by
Aleksandar Vidakovic
parent
72fd2fe134
commit
45264ea209
+1
-1
@@ -113,7 +113,7 @@ public class CenterIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testVoidCenterRetrieval() {
|
||||
ArrayList<CenterDomain> arr = CenterHelper.listCenters(requestSpec, responseSpec);
|
||||
ArrayList<CenterDomain> arr = CenterHelper.listCentersOrdered(requestSpec, responseSpec);
|
||||
int id = arr.get(arr.size() - 1).getId() + 1;
|
||||
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
|
||||
CenterDomain center = CenterHelper.retrieveByID(id, requestSpec, responseSpec);
|
||||
|
||||
+2
-2
@@ -56,8 +56,8 @@ public class CreditBureauConfigurationTest {
|
||||
public void creditBureauConfigurationTest() {
|
||||
|
||||
// create creditBureauConfiguration
|
||||
final Integer configurationId = CreditBureauConfigurationHelper.createCreditBureauConfiguration(this.requestSpec,
|
||||
this.responseSpec);
|
||||
final Integer configurationId = CreditBureauConfigurationHelper.createCreditBureauConfiguration(this.requestSpec, this.responseSpec,
|
||||
Utils.randomNameGenerator("testConfigKey_", 5));
|
||||
Assertions.assertNotNull(configurationId);
|
||||
|
||||
// update creditBureauConfiguration
|
||||
|
||||
+9
@@ -68,6 +68,15 @@ public final class CenterHelper {
|
||||
return new Gson().fromJson(jsonData, new TypeToken<ArrayList<CenterDomain>>() {}.getType());
|
||||
}
|
||||
|
||||
public static ArrayList<CenterDomain> listCentersOrdered(final RequestSpecification requestSpec,
|
||||
final ResponseSpecification responseSpec) {
|
||||
final String GET_CENTER = CENTERS_URL + "?limit=-1&orderBy=id&sortOrder=asc&" + Utils.TENANT_IDENTIFIER;
|
||||
LOG.info("------------------------ RETRIEVING CENTERS-------------------------");
|
||||
Object get = Utils.performServerGet(requestSpec, responseSpec, GET_CENTER, "");
|
||||
final String jsonData = new Gson().toJson(get);
|
||||
return new Gson().fromJson(jsonData, new TypeToken<ArrayList<CenterDomain>>() {}.getType());
|
||||
}
|
||||
|
||||
public static int createCenter(final String name, final int officeId, final RequestSpecification requestSpec,
|
||||
final ResponseSpecification responseSpec) {
|
||||
return createCenter(name, officeId, null, -1, null, null, requestSpec, responseSpec);
|
||||
|
||||
+5
-5
@@ -40,18 +40,18 @@ public class CreditBureauConfigurationHelper {
|
||||
this.responseSpec = responseSpec;
|
||||
}
|
||||
|
||||
public static Integer createCreditBureauConfiguration(final RequestSpecification requestSpec,
|
||||
final ResponseSpecification responseSpec) {
|
||||
return createCreditBureauConfiguration(requestSpec, responseSpec, "1");
|
||||
public static Integer createCreditBureauConfiguration(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
||||
String configKey) {
|
||||
return createCreditBureauConfiguration(requestSpec, responseSpec, "1", configKey);
|
||||
}
|
||||
|
||||
public static Integer createCreditBureauConfiguration(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
||||
final String creditBureauId) {
|
||||
final String creditBureauId, String configKey) {
|
||||
LOG.info("---------------------------------CREATING A CREDIT_BUREAU_CONFIGURATION---------------------------------------------");
|
||||
final String CREDITBUREAU_CONFIGURATION_URL = " /fineract-provider/api/v1/CreditBureauConfiguration/configuration/" + creditBureauId
|
||||
+ "?" + Utils.TENANT_IDENTIFIER;
|
||||
return Utils.performServerPost(requestSpec, responseSpec, CREDITBUREAU_CONFIGURATION_URL,
|
||||
creditBureauConfigurationAsJson("testConfigKey", "testConfigKeyValue", "description"), "resourceId");
|
||||
creditBureauConfigurationAsJson(configKey, "testConfigKeyValue", "description"), "resourceId");
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user