-
Notifications
You must be signed in to change notification settings - Fork 63
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
RUM-1930 Add regression test for Gson toString method #1742
RUM-1930 Add regression test for Gson toString method #1742
Conversation
4212a4a
to
b7da33f
Compare
fun `M add the properties in order in the string W toString()`(forge:Forge){ | ||
val propertiesKeysValues = forge.aMap(size = forge.anInt(min=5,max=50)){ | ||
val key = forge.aList(size = forge.anInt(min = 1, max = 10)) { | ||
anAlphabeticalString() }.joinToString(".") |
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.
Do we need to have dots in keys? We simply test that keys are added in order, we don't care about keys format.
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.
yes but I wanted to just make sure it is robust enough. It doesn't hurt to have the dots there.
* `toString` representation in the order they were added in the JSON object. | ||
*/ | ||
|
||
@Extensions(ExtendWith(ForgeExtension::class), ) |
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.
@Extensions(ExtendWith(ForgeExtension::class), ) | |
@Extensions(ExtendWith(ForgeExtension::class)) |
b7da33f
to
3324639
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## develop #1742 +/- ##
===========================================
- Coverage 83.58% 83.31% -0.27%
===========================================
Files 465 465
Lines 16182 16182
Branches 2412 2412
===========================================
- Hits 13525 13482 -43
- Misses 2016 2039 +23
- Partials 641 661 +20 |
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.
lgtm - one minor comment
append("{") | ||
propertiesKeysValues.entries.forEachIndexed { index, entry -> | ||
when (entry.value) { | ||
is Int -> append("\"${entry.key}\":${entry.value}") |
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.
Since Int and Boolean look like they have the same logic, would it make sense to do
is Int -> append("\"${entry.key}\":${entry.value}") | |
is Int, is Boolean -> append("\"${entry.key}\":${entry.value}") |
to avoid duplication?
3324639
to
e5e7b69
Compare
What does this PR do?
As a followup on the previous action taken on iOS: https://datadoghq.atlassian.net/browse/RUM-1929, I investigated all the potential issues on our end regarding this topic and came to the following conclusions:
.
attributes on our end but most of them are correctly handled in our serializers.Gson
version which changes the implementation in adding the properties into thetoString
method. Right now they are using aLinkedList
which suites us very well.In this PR I added a regression test for our Gson dependency to make sure it will always add the properties in the order they were added in the Json object when using the
toString
method.Motivation
What inspired you to submit this pull request?
Additional Notes
Anything else we should know when reviewing?
Review checklist (to be filled by reviewers)