added create and collect charges Command and support for nested dependencies

This commit is contained in:
rishy
2014-07-10 14:21:34 +05:30
parent e3658a5a8f
commit eac581c48b
27 changed files with 2072 additions and 1515 deletions
@@ -3,6 +3,8 @@ package org.mifosplatform.batch;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.core.UriInfo;
import org.junit.Assert;
import org.junit.Test;
import org.mifosplatform.batch.domain.BatchRequest;
@@ -11,33 +13,37 @@ import org.mifosplatform.batch.service.BatchApiService;
import org.mockito.Mockito;
/**
* Runs a unit test for BatchApiResource by mocking the
* BatchRequest and BatchApiService objects.
* Runs a unit test for BatchApiResource by mocking the BatchRequest and
* BatchApiService objects.
*
* @author Rishabh Shukla
*/
public class BatchBuilder {
//Verify a non-empty response by BatchApiResource.
@Test
public void batchApiTest() {
//Mock a BatchRequest objects
final BatchRequest batchTest = Mockito.mock(BatchRequest.class);
//Mock a BatchApiService object
final BatchApiService serviceTest = Mockito.mock(BatchApiService.class);
final List<BatchRequest> requestList = new ArrayList<>();
requestList.add(batchTest);
// Verify a non-empty response by BatchApiResource.
@Test
public void batchApiTest() {
//Call the BatchApiService using mocked objects
final List<BatchResponse> result = serviceTest.handleBatchRequestsWithoutEnclosingTransaction(requestList);
//Verifies whether handleBatchRequests() function of BatchApiService was called
Mockito.verify(serviceTest).handleBatchRequestsWithoutEnclosingTransaction(requestList);
// Mock a BatchRequest objects
final BatchRequest batchTest = Mockito.mock(BatchRequest.class);
//Verifies a non-empty response by the BatchApiResource
Assert.assertNotNull(result);
}
// Mock a BatchApiService object
final BatchApiService serviceTest = Mockito.mock(BatchApiService.class);
// Mock a UriInfo object
final UriInfo uriInfo = Mockito.mock(UriInfo.class);
final List<BatchRequest> requestList = new ArrayList<>();
requestList.add(batchTest);
// Call the BatchApiService using mocked objects
final List<BatchResponse> result = serviceTest.handleBatchRequestsWithoutEnclosingTransaction(requestList, uriInfo);
// Verifies whether handleBatchRequests() function of BatchApiService
// was called
Mockito.verify(serviceTest).handleBatchRequestsWithoutEnclosingTransaction(requestList, uriInfo);
// Verifies a non-empty response by the BatchApiResource
Assert.assertNotNull(result);
}
}