FINERACT-1760: Get office by external id
- [x] Add new resource to update - [x] Integration test
This commit is contained in:
committed by
Arnold Gálovics
parent
59c5ad4500
commit
f829eaa9d6
+20
@@ -24,7 +24,9 @@ import io.restassured.http.ContentType;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
import io.restassured.specification.ResponseSpecification;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.util.UUID;
|
||||
import org.apache.fineract.client.models.GetOfficesResponse;
|
||||
import org.apache.fineract.client.models.PutOfficesOfficeIdResponse;
|
||||
import org.apache.fineract.integrationtests.common.OfficeDomain;
|
||||
import org.apache.fineract.integrationtests.common.OfficeHelper;
|
||||
@@ -79,4 +81,22 @@ public class OfficeIntegrationTest {
|
||||
Assertions.assertTrue(name.equals(newOffice.getName()));
|
||||
Assertions.assertArrayEquals(dateArr, newOffice.getOpeningDate());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOfficeModificationAndFetchWithExternalId() throws IOException {
|
||||
OfficeHelper oh = new OfficeHelper(requestSpec, responseSpec);
|
||||
String externalId = UUID.randomUUID().toString();
|
||||
int officeId = oh.createOfficeWithExternalId(externalId, "01 July 2007");
|
||||
String name = Utils.uniqueRandomStringGenerator("New_Office_", 4);
|
||||
String date = "02 July 2007";
|
||||
String[] dateArr = { "2007", "7", "2" };
|
||||
|
||||
oh.updateOfficeUsingExternalId(externalId, name, date);
|
||||
Response<GetOfficesResponse> officeResult = oh.retrieveOfficeByExternalId(externalId);
|
||||
|
||||
GetOfficesResponse newOffice = officeResult.body();
|
||||
|
||||
Assertions.assertTrue(name.equals(newOffice.getName()));
|
||||
Assertions.assertTrue(newOffice.getOpeningDate().isEqual(LocalDate.of(2007, 7, 2)));
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -92,6 +92,10 @@ public class OfficeHelper extends IntegrationTest {
|
||||
new Gson().toJson(map), "resourceId");
|
||||
}
|
||||
|
||||
public Response<GetOfficesResponse> retrieveOfficeByExternalId(String externalId) throws IOException {
|
||||
return fineract().offices.retrieveOfficeByExternalId(externalId).execute();
|
||||
}
|
||||
|
||||
public Response<PutOfficesOfficeIdResponse> updateOfficeUsingExternalId(String externalId, String name, String openingDate)
|
||||
throws IOException {
|
||||
return fineract().offices
|
||||
|
||||
Reference in New Issue
Block a user