use of org.mifos.domain.builders.OfficeBuilder in project head by mifos.
the class CustomerStatusUpdateTest method updateDetailsAreSetWhenUpdatingCustomerStatus.
@Test
public void updateDetailsAreSetWhenUpdatingCustomerStatus() throws Exception {
// setup
OfficeBO office = new OfficeBuilder().withGlobalOfficeNum("xxx-9999").build();
UserContext userContext = TestUtils.makeUser();
CustomerStatusUpdate customerStatusUpdate = new CustomerStatusUpdateBuilder().build();
// stubbing
when(customerDao.findCustomerById(customerStatusUpdate.getCustomerId())).thenReturn(mockedCenter);
when(mockedCenter.getOffice()).thenReturn(office);
when(mockedCenter.getCustomerStatus()).thenReturn(new CustomerStatusEntity(CustomerStatus.CENTER_ACTIVE));
// exercise test
customerService.updateCustomerStatus(userContext, customerStatusUpdate);
// verification
verify(mockedCenter).updateDetails(userContext);
}
use of org.mifos.domain.builders.OfficeBuilder in project head by mifos.
the class OfficeDaoHibernateIntegrationTest method createOfficeHierarchy.
private void createOfficeHierarchy() {
// A default head office is added as seed data for integration tests along with a 'TestAreaOffice' as child
headOffice = IntegrationTestObjectMother.findOfficeById(Short.valueOf("1"));
regionalOffice = new OfficeBuilder().withGlobalOfficeNum("002").withName("region1").regionalOffice().withParentOffice(headOffice).build();
IntegrationTestObjectMother.createOffice(regionalOffice);
OfficeBO subRegionalOffice = new OfficeBuilder().withGlobalOfficeNum("003").withName("sub1-of-region1").subRegionalOffice().withParentOffice(regionalOffice).build();
IntegrationTestObjectMother.createOffice(subRegionalOffice);
areaOffice = new OfficeBuilder().withGlobalOfficeNum("004").withName("area-of-sub1-regional").areaOffice().withParentOffice(subRegionalOffice).build();
IntegrationTestObjectMother.createOffice(areaOffice);
branch1 = new OfficeBuilder().withGlobalOfficeNum("005").withName("branch1-of-area").branchOffice().withParentOffice(areaOffice).build();
IntegrationTestObjectMother.createOffice(branch1);
branch2 = new OfficeBuilder().withGlobalOfficeNum("006").withName("branch2-of-area").branchOffice().withParentOffice(areaOffice).build();
IntegrationTestObjectMother.createOffice(branch2);
branch3 = new OfficeBuilder().withGlobalOfficeNum("007").withName("branch1-of-regional").branchOffice().withParentOffice(regionalOffice).build();
IntegrationTestObjectMother.createOffice(branch3);
}
use of org.mifos.domain.builders.OfficeBuilder in project head by mifos.
the class PersonnelServiceFacadeWebTierTest method shouldRetrieveOfficeName.
@Test
public void shouldRetrieveOfficeName() {
// setup
Short officeId = Short.valueOf("3");
OfficeBO office = new OfficeBuilder().withName("officeTestName").build();
when(officeDao.findOfficeById(officeId)).thenReturn(office);
// exercise test
DefinePersonnelDto personnelDto = this.personnelServiceFacade.retrieveInfoForNewUserDefinition(officeId);
// verification
assertThat(personnelDto.getOfficeName(), is("officeTestName"));
}
use of org.mifos.domain.builders.OfficeBuilder in project head by mifos.
the class HolidayServiceIntegrationTest method createOfficeHierarchy.
public void createOfficeHierarchy() {
headOffice = new OfficeBuilder().withGlobalOfficeNum("001").withName("headOffice").headOffice().withParentOffice(null).build();
IntegrationTestObjectMother.createOffice(headOffice);
regionalOffice = new OfficeBuilder().withGlobalOfficeNum("002").withName("region1").regionalOffice().withParentOffice(headOffice).build();
IntegrationTestObjectMother.createOffice(regionalOffice);
OfficeBO subRegionalOffice = new OfficeBuilder().withGlobalOfficeNum("003").withName("sub1-of-region1").subRegionalOffice().withParentOffice(regionalOffice).build();
IntegrationTestObjectMother.createOffice(subRegionalOffice);
areaOffice = new OfficeBuilder().withGlobalOfficeNum("004").withName("area-of-sub1-regional").areaOffice().withParentOffice(subRegionalOffice).build();
IntegrationTestObjectMother.createOffice(areaOffice);
branch1 = new OfficeBuilder().withGlobalOfficeNum("005").withName("branch1-of-area").branchOffice().withParentOffice(areaOffice).build();
IntegrationTestObjectMother.createOffice(branch1);
branch2 = new OfficeBuilder().withGlobalOfficeNum("006").withName("branch2-of-area").branchOffice().withParentOffice(areaOffice).build();
IntegrationTestObjectMother.createOffice(branch2);
branch3 = new OfficeBuilder().withGlobalOfficeNum("007").withName("branch1-of-regional").branchOffice().withParentOffice(regionalOffice).build();
IntegrationTestObjectMother.createOffice(branch3);
StaticHibernateUtil.flushAndClearSession();
}
use of org.mifos.domain.builders.OfficeBuilder in project head by mifos.
the class ClientServiceFacadeWebTierIntegrationTest method createOfficeHierarchyUnderHeadOffice.
private void createOfficeHierarchyUnderHeadOffice(OfficeBO headOffice) {
areaOffice1 = new OfficeBuilder().areaOffice().withParentOffice(headOffice).withName("areaOffice1").withGlobalOfficeNum("x002").withSearchId("1.1.2").build();
IntegrationTestObjectMother.createOffice(areaOffice1);
branch1 = new OfficeBuilder().branchOffice().withParentOffice(areaOffice1).withName("branch1").withGlobalOfficeNum("x005").withSearchId("1.1.2.1").build();
IntegrationTestObjectMother.createOffice(branch1);
}
Aggregations