@Test public void testRefreshException() { RefreshRequest request = new RefreshRequest(4, true, false); MockBundleBAC.setReturnResult(EXCEPTION); BundleResponse response = getBundleBAI().refreshBundles(request); assertEquals(1, response.getMessageList().size()); assertEquals(BAI_KEY, response.getMessageList().get(0).getMessageInfo().getCode()); }
@Test public void testFetchAllFailure() { FetchAllRequest request = new FetchAllRequest(); MockBundleBAC.setReturnResult(FETCH_FAILURE); BundleResponse response = getBundleBAI().fetchAllBundles(request); assertEquals(2, response.getMessageList().size()); assertEquals(BAID_KEY, response.getMessageList().get(0).getMessageInfo().getCode()); }
@Test public void testDelete() { Bundle bundle = new Bundle(); bundle.setId(1); BundleMaintenanceRequest request = new BundleMaintenanceRequest(bundle, false, false); BundleResponse response = getBundleBAI().deleteBundle(request); assertTrue(response.getMessageList().isEmpty()); }
@Test public void testFetchBundlesByRequestException() { PagedInquiryRequest request = new PagedInquiryRequest(); MockBundleBAC.setReturnResult(EXCEPTION); BundleResponse response = getBundleBAI().fetchBundlesByRequest(request); assertEquals(1, response.getMessageList().size()); assertEquals(BAI_KEY, response.getMessageList().get(0).getMessageInfo().getCode()); }
@Test public void testDeleteNoBundleId() { Bundle bundle = new Bundle(); BundleMaintenanceRequest request = new BundleMaintenanceRequest(bundle, false, false); BundleResponse response = getBundleBAI().deleteBundle(request); assertEquals(1, response.getMessageList().size()); assertEquals(ID_REQUIRED, response.getMessageList().get(0).getMessageInfo().getCode()); }
@Test public void testInsert() { Bundle bundle = new Bundle(); bundle.setCode(CODE_VALUE); bundle.setDescription(DESCRIPTION_VALUE); BundleMaintenanceRequest request = new BundleMaintenanceRequest(bundle, true, true); BundleResponse response = getBundleBAI().insertBundle(request); assertTrue(response.getMessageList().isEmpty()); }
@Test public void testInsertNoBundleDescription() { Bundle bundle = new Bundle(); bundle.setCode(CODE_VALUE); BundleMaintenanceRequest request = new BundleMaintenanceRequest(bundle, false, false); BundleResponse response = getBundleBAI().insertBundle(request); assertEquals(1, response.getMessageList().size()); assertEquals(BUNDLEDESC_REQUIRED, response.getMessageList().get(0).getMessageInfo().getCode()); }
@Test public void testDeleteException() { Bundle bundle = new Bundle(); bundle.setId(1); MockBundleBAC.setReturnResult(EXCEPTION); BundleMaintenanceRequest request = new BundleMaintenanceRequest(bundle, false, false); BundleResponse response = getBundleBAI().deleteBundle(request); assertEquals(1, response.getMessageList().size()); assertEquals(BAI_KEY, response.getMessageList().get(0).getMessageInfo().getCode()); }
@Test public void testFetchByIdFailure() { FetchByIdRequest request = new FetchByIdRequest(new Integer(1)); MockBundleBAC.setReturnResult(FETCH_FAILURE); MockBundleBAC.setFailureMessageCode(BAC_KEY); BundleResponse response = getBundleBAI().fetchBundleById(request); assertEquals(1, response.getMessageList().size()); assertEquals(BAC_KEY, response.getMessageList().get(0).getMessageInfo().getCode()); }
@Test public void testUpdateNoBundleCode() { Bundle bundle = new Bundle(); bundle.setId(1); bundle.setDescription(DESCRIPTION_VALUE); BundleMaintenanceRequest request = new BundleMaintenanceRequest(bundle, false, false); BundleResponse response = getBundleBAI().updateBundle(request); assertEquals(1, response.getMessageList().size()); assertEquals(BUNDLECODE_REQUIRED, response.getMessageList().get(0).getMessageInfo().getCode()); }
@Test public void testInsertException() { Bundle bundle = new Bundle(); bundle.setCode(CODE_VALUE); bundle.setDescription(DESCRIPTION_VALUE); MockBundleBAC.setReturnResult(EXCEPTION); BundleMaintenanceRequest request = new BundleMaintenanceRequest(bundle, false, false); BundleResponse response = getBundleBAI().insertBundle(request); assertEquals(1, response.getMessageList().size()); assertEquals(BAI_KEY, response.getMessageList().get(0).getMessageInfo().getCode()); }
@Test public void testDeleteFailure() { Bundle bundle = new Bundle(); bundle.setId(1); MockBundleBAC.setReturnResult(FAILURE); MockBundleBAC.setFailureMessageCode(BAC_KEY); BundleMaintenanceRequest request = new BundleMaintenanceRequest(bundle, false, false); BundleResponse response = getBundleBAI().deleteBundle(request); assertEquals(1, response.getMessageList().size()); assertEquals(BAC_KEY, response.getMessageList().get(0).getMessageInfo().getCode()); }
@Test public void testUpdateFailure() { Bundle bundle = new Bundle(); bundle.setId(1); bundle.setCode(CODE_VALUE); bundle.setDescription(DESCRIPTION_VALUE); MockBundleBAC.setReturnResult(FAILURE); BundleMaintenanceRequest request = new BundleMaintenanceRequest(bundle, false, false); BundleResponse response = getBundleBAI().updateBundle(request); assertEquals(1, response.getMessageList().size()); assertEquals(BAC_KEY, response.getMessageList().get(0).getMessageInfo().getCode()); }
@Test public void testRefresh() { RefreshRequest request = new RefreshRequest(4, false, false); BundleResponse response = getBundleBAI().refreshBundles(request); assertTrue(response.getMessageList().isEmpty()); }
@Test public void testFetchByRequest() { BundleResponse response = getBundleBAI().fetchBundlesByRequest(new PagedInquiryRequest()); assertTrue(response.getMessageList().isEmpty()); }
@Test public void testFetchAll() { BundleResponse response = getBundleBAI().fetchAllBundles(new FetchAllRequest()); assertTrue(response.getMessageList().isEmpty()); }