-
Notifications
You must be signed in to change notification settings - Fork 2
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
Added assertions on converters unit tests #28
Conversation
questionnaireResponse.getItem().get(3).getAnswer().get(0).getValue().as(com.ibm.fhir.model.type.String.class) | ||
.getValue(), event.getTeam()); | ||
//TODO : Do we need to test individual obs, details and identifier fields? | ||
System.out.println(questionnaireResponse); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assert number of items created, also assert for 2 obs one with single value and one with several variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
assertEquals(fihrTask.getBasedOn().get(0).getReference().getValue(), task.getPlanIdentifier()); | ||
assertEquals(fihrTask.getMeta().getVersionId().getValue(), String.valueOf(task.getServerVersion())); | ||
assertEquals(fihrTask.getIntent().getValueAsEnumConstant().value(), "plan"); | ||
//TODO: Do we need to add assertions for Notes individually? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can test size of notes and one note is properly converted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
assertEquals(patient.getIdentifier().size(),identifiersSize); | ||
assertEquals(patient.getBirthDate().getValue().toString(),client.getBirthdate().toString("YYYY-MM-DD")); | ||
assertEquals(patient.getDeceased().as(com.ibm.fhir.model.type.DateTime.class).getValue().toString(),client.getDeathdate().toString("yyyy-MM-dd'T'HH:mm'Z'")); | ||
//TODO : Individual assertions on relationships, attributes and identifiers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test number of size of relationships, attributes and identifiers converted is accurate and also assert one item from each category
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the first param is expected and second is actual for assertEquals
update this for all such assertions
FHIRPathElementNode node = PathEvaluatorLibrary.getInstance().evaluateElementExpression(questionnaireResponse, "QuestionnaireResponse.item.where(linkId='totPopulation')"); | ||
QuestionnaireResponse.Item totPopulation = node.element().as(QuestionnaireResponse.Item.class); | ||
assertEquals(1,totPopulation.getAnswer().size()); | ||
assertEquals(com.ibm.fhir.model.type.String.of("2"),totPopulation.getAnswer().get(0).getValue()); | ||
node = PathEvaluatorLibrary.getInstance().evaluateElementExpression(questionnaireResponse, "QuestionnaireResponse.item.where(linkId='existingLLINs')"); | ||
|
||
QuestionnaireResponse.Item existingLLINs = node.element().as(QuestionnaireResponse.Item.class); | ||
assertEquals(2, existingLLINs.getAnswer().size()); //Test for multiple values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed this instead of looping for all the items to use FHIRPath expressions to look up obs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
assertEquals(patient.getDeceased().as(com.ibm.fhir.model.type.DateTime.class).getValue().toString(), | ||
client.getDeathdate().toString("yyyy-MM-dd'T'HH:mm'Z'")); | ||
for (Identifier identifier : patient.getIdentifier()) { | ||
if (identifier.getSystem() != null && identifier.getSystem().getValue() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use fhirpath expressions for lookup as if the identifier does not exist then test will fail. With this approach of looping tests will fail if identifiers don't exist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
Resolves #26