@SuppressWarnings("unchecked") @Test(expectedExceptions = { TechnicalException.class }) public void ioExceptionThrown() throws BusinessException, JAXBException, IOException { ciService.addApplicationDefinition(firstAppDefinition); when(ciManager.updateBusinessContextDefinition(any(BusinessContextDefinition.class))).thenThrow(IOException.class); ciService.updateApplicationDefinition(firstAppDefinition); } }
@SuppressWarnings("unchecked") @Test(expectedExceptions = { TechnicalException.class }) public void jaxbExceptionThrown() throws BusinessException, JAXBException, IOException { ciService.addApplicationDefinition(firstAppDefinition); when(ciManager.updateBusinessContextDefinition(any(BusinessContextDefinition.class))).thenThrow(JAXBException.class); ciService.updateApplicationDefinition(firstAppDefinition); }
@Test(expectedExceptions = { BusinessException.class }) public void updateNull() throws BusinessException { ciService.addApplicationDefinition(firstAppDefinition); ciService.addApplicationDefinition(secondAppDefinition); ciService.updateApplicationDefinition(null); }
@Test(expectedExceptions = { BusinessException.class }) public void updateUnknown() throws BusinessException { ciService.addApplicationDefinition(firstAppDefinition); ciService.addApplicationDefinition(secondAppDefinition); ciService.updateApplicationDefinition(new ApplicationDefinition(123456789, "unknown", null)); }
@Test public void updateApplicationDefition() throws BusinessException { ciService.addApplicationDefinition(firstAppDefinition); ciService.addApplicationDefinition(secondAppDefinition); firstAppDefinition.setApplicationName("newName"); ciService.updateApplicationDefinition(firstAppDefinition); assertThat(ciService.getApplicationDefinition(firstApplicationId).getApplicationName(), equalTo("newName")); assertThat(ciService.getApplicationDefinition(secondApplicationId).getApplicationName(), equalTo("secondAppDefinition")); }