public CompleteProgramElement(FormEntryContext context, Map<String, String> parameters) { try { program = HtmlFormEntryUtil.getProgram(parameters.get("programId")); } catch (Exception ex) { throw new IllegalArgumentException("Couldn't find program in: " + parameters); } }
/** * @see {@link HtmlFormEntryUtil#getProgram(String)} */ @Test @Verifies(value = "should return null otherwise", method = "getProgram(String)") public void getProgram_shouldReturnNullOtherwise() throws Exception { String id = null; Assert.assertNull(HtmlFormEntryUtil.getProgram(id)); id = ""; Assert.assertNull(HtmlFormEntryUtil.getProgram(id)); id = "100000";//not exist in the standardTestData Assert.assertNull(HtmlFormEntryUtil.getProgram(id)); id = "ASDFASDFEAF";//random string Assert.assertNull(HtmlFormEntryUtil.getProgram(id)); id = "-";//uuid style Assert.assertNull(HtmlFormEntryUtil.getProgram(id)); }
public EnrollInProgramElement(FormEntryContext context, Map<String, String> parameters) { try { program = HtmlFormEntryUtil.getProgram(parameters.get("programId")); if (program == null) throw new FormEntryException("");
/** * @see {@link HtmlFormEntryUtil#getProgram(String)} */ @Test @Verifies(value = "should return null otherwise", method = "getProgram(String)") public void getPerson_shouldReturnNullOtherwise() throws Exception { String id = null; Assert.assertNull(HtmlFormEntryUtil.getProgram(id)); id = ""; Assert.assertNull(HtmlFormEntryUtil.getProgram(id)); id = "100000";//not exist in the standardTestData Assert.assertNull(HtmlFormEntryUtil.getProgram(id)); id = "ASDFASDFEAF";//random string Assert.assertNull(HtmlFormEntryUtil.getProgram(id)); id = "-";//uuid style Assert.assertNull(HtmlFormEntryUtil.getProgram(id)); }
Program personProgram = HtmlFormEntryUtil.getProgram(prog);
/** * @see {@link HtmlFormEntryUtil#getProgram(String)} this is the name test */ @Test @Verifies(value = "should find a program by its name", method = "getProgram(String)") public void getProgram_shouldFindAProgramByItsName() throws Exception { Assert.assertEquals("71779c39-d289-4dfe-91b5-e7cfaa27c78b", HtmlFormEntryUtil.getProgram("MDR-TB PROGRAM").getUuid()); }
/** * @see {@link HtmlFormEntryUtil#getProgram(String)} this is the uuid test */ @Test @Verifies(value = "should find a program by its uuid", method = "getProgram(String)") public void getProgram_shouldFindAProgramByItsUuid() throws Exception { Assert.assertEquals("MDR program", HtmlFormEntryUtil.getProgram("71779c39-d289-4dfe-91b5-e7cfaa27c78b").getName()); }
Program program = HtmlFormEntryUtil.getProgram(id); if (program != null) { dependencies.add(program);
/** * @see {@link HtmlFormEntryUtil#getProgram(String)} id test */ @Test @Verifies(value = "should find a program by its Id", method = "getProgram(String)") public void getProgram_shouldFindAProgramByItsId() throws Exception { Assert.assertEquals("MDR program", HtmlFormEntryUtil.getProgram("2").getName()); }