IncidentFormServiceImpl implements IncidentFormService { @Override public IncidentTemplateForm getGBVTemplate() { Blob form = incidentFormDao.getIncidentForm(PrimeroAppConfiguration.MODULE_ID_GBV, PrimeroAppConfiguration .getApiBaseUrl()).getForm(); return getIncidentTemplateForm(form); } IncidentFormServiceImpl(IncidentFormDao incidentFormDao); boolean isReady(); @Override IncidentTemplateForm getGBVTemplate(); void saveOrUpdate(IncidentForm incidentForm); @Override List<String> getViolenceTypeList(); @Override List<String> getLocationList(); static final String TAG; static final String SECTION_TYPE_OF_VIOLENCE; static final String SECTION_GBV_INCIDENT; }
@Test public void should_get_incident_form() throws IOException { IncidentForm incidentForm = new IncidentForm(); incidentForm.setForm(new Blob(formForm.getBytes())); when(incidentFormDao.getIncidentForm(anyString(), anyString())).thenReturn(incidentForm); IncidentTemplateForm form = incidentFormService.getGBVTemplate(); assertThat(form.getSections().size(), is(1)); Section section = form.getSections().get(0); assertThat(section.getName().get("en"), is("Record Owner")); assertThat(section.getOrder(), is(10)); assertThat(section.getHelpText().get("en"), is("")); assertThat(section.getBaseLanguage(), is("en")); Field field = section.getFields().get(0); assertThat(field.getName(), is("incidentworker_name")); assertThat(field.getDisplayName().get("en"), is("Field/Incident/Social Worker")); assertThat(field.getHelpText().get("en"), is("")); assertThat(field.getType(), is("text_field")); assertThat(field.getOptionStringsText().get("en").size(), is(0)); assertThat(field.isShowOnMiniForm(), is(true)); assertThat(field.isMultiSelect(), is(false)); assertThat(field.isEditable(), is(true)); assertThat(field.isRequired(), is(false)); assertThat(field.getSubForm(), is(nullValue())); }