use of org.mifos.customers.business.CustomerNoteEntity in project head by mifos.
the class ClientStatusChangeIntegrationTest method givenGroupIsInCancelledStateShouldNotPassValidationWhenTryingToTranistionClientToActive.
@Test
public void givenGroupIsInCancelledStateShouldNotPassValidationWhenTryingToTranistionClientToActive() throws Exception {
// setup
CenterBO existingCenter = new CenterBuilder().with(existingMeeting).withName("Center-IntegrationTest").with(existingOffice).withLoanOfficer(existingLoanOfficer).withUserContext().build();
IntegrationTestObjectMother.createCenter(existingCenter, existingMeeting);
GroupBO existingCancelledGroup = new GroupBuilder().withName("newGroup").withStatus(CustomerStatus.GROUP_CANCELLED).withParentCustomer(existingCenter).formedBy(existingUser).build();
IntegrationTestObjectMother.createGroup(existingCancelledGroup, existingMeeting);
ClientBO existingPartialClient = new ClientBuilder().withStatus(CustomerStatus.CLIENT_PARTIAL).withParentCustomer(existingCancelledGroup).buildForIntegrationTests();
IntegrationTestObjectMother.createClient(existingPartialClient, existingMeeting);
existingCancelledGroup = this.customerDao.findGroupBySystemId(existingCancelledGroup.getGlobalCustNum());
existingPartialClient = this.customerDao.findClientBySystemId(existingPartialClient.getGlobalCustNum());
existingPartialClient.setUserContext(TestUtils.makeUser());
CustomerStatusFlag customerStatusFlag = null;
CustomerNoteEntity customerNote = new CustomerNoteEntity("go active", new Date(), existingPartialClient.getPersonnel(), existingPartialClient);
// exercise test
try {
customerService.updateClientStatus(existingPartialClient, existingPartialClient.getStatus(), CustomerStatus.CLIENT_ACTIVE, customerStatusFlag, customerNote);
fail("should fail validation");
} catch (CustomerException expected) {
assertThat(expected.getKey(), is(ClientConstants.ERRORS_GROUP_CANCELLED));
assertThat(existingPartialClient.getStatus(), is(CustomerStatus.CLIENT_PARTIAL));
}
}
use of org.mifos.customers.business.CustomerNoteEntity in project head by mifos.
the class TestObjectFactory method getCustomerNote.
public static CustomerNoteEntity getCustomerNote(final String comment, final CustomerBO customer) {
java.sql.Date commentDate = new java.sql.Date(System.currentTimeMillis());
CustomerNoteEntity notes = new CustomerNoteEntity(comment, commentDate, customer.getPersonnel(), customer);
return notes;
}
Aggregations