Search in sources :

Example 6 with ClientPersonalInfoUpdate

use of org.mifos.dto.domain.ClientPersonalInfoUpdate in project head by mifos.

the class ClientUpdateTest method rollsbackTransactionClosesSessionAndReThrowsApplicationException2.

@Test(expected = CustomerException.class)
public void rollsbackTransactionClosesSessionAndReThrowsApplicationException2() throws Exception {
    // setup
    UserContext userContext = TestUtils.makeUser();
    ClientPersonalInfoUpdate clientPersonalInfoUpdate = new ClientPersonalInfoUpdateBuilder().build();
    // stubbing
    when(customerDao.findCustomerById(clientPersonalInfoUpdate.getCustomerId())).thenReturn(mockedClient);
    doThrow(new CustomerException(ClientConstants.INVALID_DOB_EXCEPTION)).when(mockedClient).updatePersonalInfo(clientPersonalInfoUpdate);
    // exercise test
    customerService.updateClientPersonalInfo(userContext, clientPersonalInfoUpdate);
    // verification
    verify(hibernateTransactionHelper).rollbackTransaction();
    verify(hibernateTransactionHelper).closeSession();
}
Also used : ClientPersonalInfoUpdate(org.mifos.dto.domain.ClientPersonalInfoUpdate) CustomerException(org.mifos.customers.exceptions.CustomerException) UserContext(org.mifos.security.util.UserContext) ClientPersonalInfoUpdateBuilder(org.mifos.domain.builders.ClientPersonalInfoUpdateBuilder) Test(org.junit.Test)

Aggregations

ClientPersonalInfoUpdate (org.mifos.dto.domain.ClientPersonalInfoUpdate)6 UserContext (org.mifos.security.util.UserContext)6 Test (org.junit.Test)5 ClientPersonalInfoUpdateBuilder (org.mifos.domain.builders.ClientPersonalInfoUpdateBuilder)5 CustomerException (org.mifos.customers.exceptions.CustomerException)3 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 MifosRuntimeException (org.mifos.core.MifosRuntimeException)1 ClientBO (org.mifos.customers.client.business.ClientBO)1 ClientCustActionForm (org.mifos.customers.client.struts.actionforms.ClientCustActionForm)1 AddressDto (org.mifos.dto.domain.AddressDto)1 CustomFieldDto (org.mifos.dto.domain.CustomFieldDto)1 ClientNameDetailDto (org.mifos.dto.screen.ClientNameDetailDto)1 ClientPersonalDetailDto (org.mifos.dto.screen.ClientPersonalDetailDto)1 ClientPersonalInfoDto (org.mifos.dto.screen.ClientPersonalInfoDto)1 CloseSession (org.mifos.framework.util.helpers.CloseSession)1 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)1 InOrder (org.mockito.InOrder)1