Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix StandardEntityChanger to support String casting when possible #198

Merged
merged 6 commits into from
Dec 19, 2023

Conversation

scriptom
Copy link
Contributor

Currently, the StandardEntityChanger will fail to set text fields if the incoming parameter is not of String type. This PR fixes this to at least guarantee Integer/Double cast support, however every data type should be cast-able to String via the Obejct.toString() method.

entityChanger.setField(testBullhornEntity, "simpleStringContainer", "Test");
assertEquals("Test", testBullhornEntity.getAdditionalProperties().get("simpleStringContainer"));
}

Copy link
Contributor

@taswartz taswartz Sep 29, 2023

Choose a reason for hiding this comment

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

Could we add a test like the following?

@Test
    public void setFieldSavesFailedCastsToAdditionalPropertiesIfAvailable() {
        EntityChanger entityChanger = new StandardEntityChanger();
        entityChanger.setField(testBullhornEntity, "simpleStringContainer.someOtherEntity.id", "Test");
        assertEquals("Test", testBullhornEntity.getAdditionalProperties().get("simpleStringContainer.someOtherEntity.id"));
    }

I think this will actually throw an error in our case

Copy link
Member

@johnsully83 johnsully83 left a comment

Choose a reason for hiding this comment

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

Looks good to me

@taswartz taswartz merged commit 3565409 into bullhorn:master Dec 19, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants