Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRUNK-6193: Create a HibernateFormDAO junit test #4604

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.*;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.openmrs.EncounterType;
import org.openmrs.Field;
import org.openmrs.Form;
import org.openmrs.FormField;
Expand Down Expand Up @@ -59,4 +58,34 @@ public void shouldGetFormFieldsByForm() {
assertEquals(form.getFormId(), formField.getForm().getFormId());
}
}

@Test
public void shouldGetFormFieldsByField() {
Field field = new Field(1);
FormField formField = new FormField(2);
formField.setField(field);
List<FormField> formFields = dao.getFormFieldsByField(field);
assertNotNull(formFields);
assertEquals(3, formFields.size());
}

@Test
public void shouldGetFormCount() {
String partialName = "Basic Form";
Boolean published = false;
Collection<EncounterType> encounterTypes = new ArrayList<>();
Boolean retired = false;
Collection<FormField> containingAnyFormField = new ArrayList<>();
Collection<FormField> containingAllFormFields = new ArrayList<>();
Collection<Field> fields = new ArrayList<>();
Integer formCount = dao.getFormCount(partialName,
published,
encounterTypes,
retired,
containingAnyFormField,
containingAllFormFields,
fields);
assertNotNull(formCount);
assertEquals(2, formCount);
}
}
Loading