use of org.mifos.dto.domain.CustomFieldDto in project head by mifos.
the class CenterUpdateUsingCustomerServiceIntegrationTest method canUpdateCenterWithDifferentMfiJoiningDateInPastOrFuture.
@Test
public void canUpdateCenterWithDifferentMfiJoiningDateInPastOrFuture() throws Exception {
// setup
Short loanOfficerId = center.getPersonnel().getPersonnelId();
String externalId = center.getExternalId();
LocalDate dateInPast = new LocalDate(center.getMfiJoiningDate()).minusWeeks(4);
String mfiJoiningDate = new SimpleDateFormat("dd/MM/yyyy").format(dateInPast.toDateMidnight().toDate());
AddressDto address = null;
if (center.getAddress() != null) {
address = Address.toDto(center.getAddress());
}
List<CustomFieldDto> customFields = new ArrayList<CustomFieldDto>();
List<CustomerPositionDto> customerPositions = new ArrayList<CustomerPositionDto>();
String updatedDisplayName = "Center " + RandomStringUtils.randomAlphanumeric(5);
CenterUpdate centerUpdate = new CenterUpdate(center.getCustomerId(), updatedDisplayName, center.getVersionNo(), loanOfficerId, externalId, mfiJoiningDate, address, customFields, customerPositions);
UserContext userContext = TestUtils.makeUser();
// exercise test
customerService.updateCenter(userContext, centerUpdate);
// verification
center = customerDao.findCenterBySystemId(center.getGlobalCustNum());
assertThat(center.getMfiJoiningDate(), is(dateInPast.toDateMidnight().toDate()));
}
Aggregations