10BC0 DefectDojo Hook Tests now pass on any OS by JohannesZahn · Pull Request #596 · secureCodeBox/secureCodeBox · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@JohannesZahn
Copy link
Contributor

Description

Unit Tests on Windows failed even though they were supposed to pass. This was due asserting JSON Objects as equal that contained different line breaks. This was fixed by using the Library JSONAssert.

Checklist

  • Test your changes as thoroughly as possible before you commit them. Preferably, automate your test by unit/integration tests.
  • Make sure npm test runs for the whole project.
  • Make codeclimate checks happy

Signed-off-by: Johannes Zahn <johannes.zahn@iteratec.com>
@JohannesZahn JohannesZahn changed the title DefectDojo Hook Tests now works with any OS DefectDojo Hook Tests now succeed with any OS Aug 12, 2021
@JohannesZahn JohannesZahn changed the title DefectDojo Hook Tests now succeed with any OS DefectDojo Hook Tests now pass on any OS Aug 12, 2021
Signed-off-by: Johannes Zahn <johannes.zahn@iteratec.com>
@J12934
Copy link
Member
J12934 commented Aug 12, 2021

Could we remove the Json assert Lib by parsing the Json into our Finding Class and running the assertions on these?

@JohannesZahn
Copy link
Contributor Author

It should be possible unless Jackson changes the order of the list which I am not completly sure on right now. I am also not sure if we should then use Jacksons ObjectNode.equals() on the JSON Findings or rely on a custom/lombok generated Equals methods on the Objects themselves. The second approach would look somewhat like this

DefectDojoImportFinding[] expectedDDFindings = jsonMapper.readValue(ddFindingsUrl, DefectDojoImportFinding[].class);
DefectDojoImportFinding[] actualDdFindings = jsonMapper.readValue(actualDdFindingsString, DefectDojoImportFinding[].class);
assertArrayEquals(expectedDDFindings,actualDdFindings);

@JohannesZahn
Copy link
Contributor Author

This moved to #600

@Weltraumschaf Weltraumschaf deleted the bugfix/test-depending-on-linefeed branch February 21, 2023 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0