@Test public void moveToSameIndex() throws BusinessException { ciService.addApplicationDefinition(firstAppDefinition); ciService.addApplicationDefinition(secondAppDefinition); ciService.moveApplicationDefinition(secondAppDefinition, 1); assertThat(ciService.getApplicationDefinitions().get(0), is(firstAppDefinition)); assertThat(ciService.getApplicationDefinitions().get(1), is(secondAppDefinition)); }
@Test public void moveApplicationDefinitionUp() throws BusinessException { ciService.addApplicationDefinition(firstAppDefinition); ciService.addApplicationDefinition(secondAppDefinition); ciService.moveApplicationDefinition(secondAppDefinition, 0); assertThat(ciService.getApplicationDefinitions().get(0), is(secondAppDefinition)); assertThat(ciService.getApplicationDefinitions().get(1), is(firstAppDefinition)); }
@SuppressWarnings("unchecked") @Test(expectedExceptions = { TechnicalException.class }) public void jaxbExceptionThrown() throws BusinessException, JAXBException, IOException { ciService.addApplicationDefinition(firstAppDefinition); ciService.addApplicationDefinition(secondAppDefinition); when(ciManager.updateBusinessContextDefinition(any(BusinessContextDefinition.class))).thenThrow(JAXBException.class); ciService.moveApplicationDefinition(secondAppDefinition, 0); }
@Test(expectedExceptions = { BusinessException.class }) public void moveToFar() throws BusinessException { ciService.addApplicationDefinition(firstAppDefinition); ciService.addApplicationDefinition(secondAppDefinition); ciService.moveApplicationDefinition(secondAppDefinition, 2); }
@SuppressWarnings("unchecked") @Test(expectedExceptions = { TechnicalException.class }) public void ioExceptionThrown() throws BusinessException, JAXBException, IOException { ciService.addApplicationDefinition(firstAppDefinition); ciService.addApplicationDefinition(secondAppDefinition); when(ciManager.updateBusinessContextDefinition(any(BusinessContextDefinition.class))).thenThrow(IOException.class); ciService.moveApplicationDefinition(secondAppDefinition, 0); } }
@Test public void moveApplicationDefinitionDown() throws BusinessException { ciService.addApplicationDefinition(firstAppDefinition); ciService.addApplicationDefinition(secondAppDefinition); ciService.moveApplicationDefinition(firstAppDefinition, 1); assertThat(ciService.getApplicationDefinitions().get(0), is(secondAppDefinition)); assertThat(ciService.getApplicationDefinitions().get(1), is(firstAppDefinition)); }
@Test(expectedExceptions = { BusinessException.class }) public void moveNull() throws BusinessException { ciService.addApplicationDefinition(firstAppDefinition); ciService.addApplicationDefinition(secondAppDefinition); ciService.moveApplicationDefinition(null, 0); }
@Test(expectedExceptions = { BusinessException.class }) public void moveUnknown() throws BusinessException { ciService.addApplicationDefinition(firstAppDefinition); ciService.addApplicationDefinition(secondAppDefinition); ciService.moveApplicationDefinition(new ApplicationDefinition(123456789, "unknown", null), 0); }