FormService { public List<FormField> getHighlightedFields(String formName) { List<FormField> formFields = new ArrayList<FormField>(); List<FormSection> formSections = getFormSections(formName); for (FormSection formSection : formSections) { formFields.addAll(formSection.getOrderedHighLightedFields()); } return formFields; } @Inject  FormService(RapidFtrApplication context); void downloadPublishedFormSections(); List<FormSection> getFormSections(String formName); void setFormSections(List<FormSection> formSections); List<FormField> getHighlightedFields(String formName); List<FormField> getTitleFields(String formName); static final String FORM_SECTIONS_PREF; static final String API_FORM_SECTIONS_PATH; }
@Test public void shouldReturnHighlightedFieldsForChildForm() throws IOException { when(sharedPreferences.getString(FormService.FORM_SECTIONS_PREF, null)).thenReturn(null); List<FormField> formFields = formService.getHighlightedFields(Child.CHILD_FORM_NAME); int expectedNoOfHighlightedFields = 4; assertEquals(expectedNoOfHighlightedFields, formFields.size()); }