/** * Test method for {@link org.bonitasoft.engine.command.api.impl.CommandServiceImpl#get(long)}. * * @throws SCommandNotFoundException * @throws SBonitaReadException */ @Test public final void getById() throws SCommandNotFoundException, SBonitaReadException { final SCommand sCommand = mock(SCommand.class); when(persistence.selectById(any(SelectByIdDescriptor.class))).thenReturn(sCommand); Assert.assertEquals(sCommand, commandServiceImpl.get(456L)); }
@Test(expected = SCommandNotFoundException.class) public final void getByIdThrowException() throws SBonitaReadException, SCommandNotFoundException { when(persistence.selectById(any(SelectByIdDescriptor.class))) .thenThrow(new SBonitaReadException("")); commandServiceImpl.get(456L); }
@Test(expected = SCommandNotFoundException.class) public final void getByNameNotExists() throws SBonitaReadException, SCommandNotFoundException { when(persistence.selectOne(any(SelectOneDescriptor.class))).thenReturn(null); commandServiceImpl.get("name"); }