Skip to content

Adds all fields in RequestOverrideConfiguration in toBuilder #2862

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

Merged
merged 3 commits into from
Nov 22, 2021

Conversation

cenedhryn
Copy link
Contributor

Motivation and Context

When a requestOverrideConfiguration is modified from an existing instance all values of existing fields should be copied. For instance, metricPublishers was missing, leading to the paginated operations code path missing metric publishers added as a request override and no metrics are published.

Description

Updated the BuilderImpl constructor that takes a RequestOverrideConfiguration as an argument.

Testing

  • Added unit tests to cover minimal and maximal cases of converting to builder and back
  • Added functional test to verify usage of publishers

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed
  • A short description of the change has been added to the CHANGELOG
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@cenedhryn cenedhryn requested a review from a team as a code owner November 19, 2021 22:33
.addMetricPublisher(mock(MetricPublisher.class))
.build();

assertThat(configuration.toBuilder().build()).isEqualTo(configuration);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we use something like usingRecursiveComparison() here?

https://assertj.github.io/doc/#assertj-core-recursive-comparison

Or does the combination of EqualsVerifier and isEqualTo provide similar guarantees?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this situation they yield similar results, but I do like the more verbose output of usingRecursiveComparison()

@cenedhryn cenedhryn force-pushed the salande/metrics-with-paginatin branch from 6fde02c to 5841de1 Compare November 20, 2021 00:43
.addMetricPublisher(mock(MetricPublisher.class))
.build();

assertThat(configuration.toBuilder().build()).usingRecursiveComparison().isEqualTo(configuration);
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice if we could find a way to enforce this validation for all of our classes that implement toBuilder().

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@cenedhryn cenedhryn merged commit bb88f76 into master Nov 22, 2021
@cenedhryn cenedhryn deleted the salande/metrics-with-paginatin branch September 9, 2022 18:51
aws-sdk-java-automation added a commit that referenced this pull request Jan 17, 2024
…4e66acdd3

Pull request: release <- staging/f218cb95-de05-40e5-a8fa-3d64e66acdd3
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