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

equals shallow equals deep not functioning? #325

Closed
ipropper opened this Issue Mar 31, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@ipropper

ipropper commented Mar 31, 2016

What are equals deep and equals shallow calculating? All these should be equal right? Only 2 prints.

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
Date date = dateFormat.parse("19920925");
FhirContext context = FhirContext.forDstu3();

Patient patient1 = new Patient();
patient1.setBirthDate(date)
        .setGender(Enumerations.AdministrativeGender.MALE)
        .addName().setUse(HumanName.NameUse.OFFICIAL).addGiven("first").addGiven("second").addFamily("family");

Patient patient2 = context.newJsonParser().parseResource(Patient.class,
        context.newJsonParser().encodeResourceToString(patient1));

if(patient1.equalsDeep(patient2))
{
    System.out.println("1");
}
if(patient1.equalsShallow(patient2))
{
    System.out.println("2");
}

Patient patient3 = new Patient();
patient3.setBirthDate(date)
        .setGender(Enumerations.AdministrativeGender.MALE)
        .addName().setUse(HumanName.NameUse.OFFICIAL).addGiven("first").addGiven("second").addFamily("family");

if(patient1.equalsDeep(patient3)) {
    System.out.println("3");
}
if(patient1.equalsShallow(patient3))
{
    System.out.println("4");
}
@jamesagnew

This comment has been minimized.

Owner

jamesagnew commented Apr 6, 2016

Thanks for reporting! Checking in a fix shortly.

@jamesagnew jamesagnew closed this in e30ebf6 Apr 6, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment