diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/ClientLoanIntegrationTest.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/ClientLoanIntegrationTest.java index a477614e8..a36c5f0a3 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/ClientLoanIntegrationTest.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/ClientLoanIntegrationTest.java @@ -18,10 +18,7 @@ import com.jayway.restassured.builder.ResponseSpecBuilder; import com.jayway.restassured.http.ContentType; import com.jayway.restassured.specification.RequestSpecification; import com.jayway.restassured.specification.ResponseSpecification; -import org.mifosplatform.integrationtests.common.LoanApplicationTestBuilder; -import org.mifosplatform.integrationtests.common.LoanProductTestBuilder; -import org.mifosplatform.integrationtests.common.LoanTransactionHelper; -import org.mifosplatform.integrationtests.common.Utils; +import org.mifosplatform.integrationtests.common.*; /** * Client Loan Integration Test for checking Loan Application Repayment Schedule. @@ -41,8 +38,8 @@ public class ClientLoanIntegrationTest { @Test public void checkClientLoanCreateAndDisburseFlow(){ - Integer clientID = Utils.createClient(requestSpec, responseSpec); - Utils.verifyClientCreatedOnServer(requestSpec, responseSpec, clientID); + Integer clientID = ClientBuilder.createClient(requestSpec, responseSpec); + ClientBuilder.verifyClientCreatedOnServer(requestSpec, responseSpec, clientID); Integer loanProductID = createLoanProduct(); Integer loanID= applyForLoanApplication(clientID, loanProductID); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/LoanWithWaiveInterestAndWriteOff.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/LoanWithWaiveInterestAndWriteOff.java index aa6bfda0f..bdbba3bd2 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/LoanWithWaiveInterestAndWriteOff.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/LoanWithWaiveInterestAndWriteOff.java @@ -55,8 +55,8 @@ public class LoanWithWaiveInterestAndWriteOff { @Test public void checkClientLoanCreateAndDisburseFlow(){ //CREATE CLIENT - Integer clientID = Utils.createClient(requestSpec, responseSpec, DATE_OF_JOINING); - Utils.verifyClientCreatedOnServer(requestSpec, responseSpec, clientID); + Integer clientID = ClientBuilder.createClient(requestSpec, responseSpec, DATE_OF_JOINING); + ClientBuilder.verifyClientCreatedOnServer(requestSpec, responseSpec, clientID); //CREATE LOAN PRODUCT Integer loanProductID = createLoanProduct(); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/LoanProductTestBuilder.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/LoanProductTestBuilder.java index 05eaa7769..5a5880d69 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/LoanProductTestBuilder.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/LoanProductTestBuilder.java @@ -26,7 +26,7 @@ public class LoanProductTestBuilder { private static final String ACCRUAL_BASED ="3"; - private String nameOfLoanProduct = Utils.randomNameGenerator("LOAN_PRODUCT_", 6); + private String nameOfLoanProduct = ClientBuilder.randomNameGenerator("LOAN_PRODUCT_", 6); private String principal = "10000.00"; private String numberOfRepayments = "0"; private String repaymentFrequency = WEEK; @@ -63,16 +63,16 @@ public class LoanProductTestBuilder { return new Gson().toJson(map); } - public LoanProductTestBuilder withLoanName(String loanName){ + public LoanProductTestBuilder withLoanName(final String loanName){ this.nameOfLoanProduct=loanName; return this; } - public LoanProductTestBuilder withPrincipal(String principal){ + public LoanProductTestBuilder withPrincipal(final String principal){ this.principal = principal; return this; } - public LoanProductTestBuilder withNumberOfRepayments(String numberOfRepayment){ + public LoanProductTestBuilder withNumberOfRepayments(final String numberOfRepayment){ this.numberOfRepayments = numberOfRepayment; return this; } @@ -93,7 +93,7 @@ public class LoanProductTestBuilder { return this; } - public LoanProductTestBuilder withRepaymentAfterEvery(String repaymentAfterEvery){ + public LoanProductTestBuilder withRepaymentAfterEvery(final String repaymentAfterEvery){ this.repaymentPeriod=repaymentAfterEvery; return this; } @@ -108,7 +108,7 @@ public class LoanProductTestBuilder { return this; } - public LoanProductTestBuilder withinterestRatePerPeriod(String interestRatePerPeriod) { + public LoanProductTestBuilder withinterestRatePerPeriod(final String interestRatePerPeriod) { this.interestRatePerPeriod=interestRatePerPeriod; return this; } @@ -143,7 +143,7 @@ public class LoanProductTestBuilder { return this; } - public LoanProductTestBuilder withInArrearsTolerance (String amountCanBeWaved){ + public LoanProductTestBuilder withInArrearsTolerance (final String amountCanBeWaved){ this.inArrearsTolerance = amountCanBeWaved; return this; } diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/LoanStatusChecker.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/LoanStatusChecker.java index 5f6a9a243..7b21da6c7 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/LoanStatusChecker.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/LoanStatusChecker.java @@ -1,9 +1,13 @@ package org.mifosplatform.integrationtests.common; +import com.jayway.restassured.specification.RequestSpecification; +import com.jayway.restassured.specification.ResponseSpecification; import junit.framework.Assert; import java.util.HashMap; +import static com.jayway.restassured.RestAssured.given; +import static com.jayway.restassured.path.json.JsonPath.from; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -36,4 +40,9 @@ public class LoanStatusChecker { public static void verifyLoanAccountIsClosed(HashMap loanStatusHashMap){ Assert.assertTrue(getStatus(loanStatusHashMap, "closed")); } + + public static HashMap getStatusOfLoan(RequestSpecification requestSpec, ResponseSpecification responseSpec, Integer loanID){ + String url = "/mifosng-provider/api/v1/loans/" + loanID + "?tenantIdentifier=default"; + return Utils.performServerGet(requestSpec, responseSpec, url, "status"); + } }