@Test public void testFindTemplatesWithUnknownCodes() { // when final List<RendererTemplateModel> templates = rendererTemplateDao.findRendererTemplatesByCode("unknown"); // then Assert.assertTrue(templates.isEmpty()); }
@Test public void testFindTemplatesWithNullCode() { // when try { rendererTemplateDao.findRendererTemplatesByCode(null); Assert.fail("Should throw IllegalArgumentException because code is null"); } catch (final IllegalArgumentException ex) { // OK } }
@Test public void testFindTemplatesForExistingOne() { // when final List<RendererTemplateModel> templates = rendererTemplateDao.findRendererTemplatesByCode("DefaultCronJobFinishNotificationTemplate"); // then Assert.assertEquals(templates.size(), 1); Assert.assertEquals(templates.get(0).getCode(), "DefaultCronJobFinishNotificationTemplate"); }