@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 testInsertNoBundleCode() { Bundle bundle = new Bundle(); bundle.setDescription(DESCRIPTION_VALUE); BundleMaintenanceRequest request = new BundleMaintenanceRequest(bundle, false, false); BundleResponse response = getBundleBAI().insertBundle(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 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()); }