Skip to content
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

Pure refactoring of UpdateItemOperation tests #2910

Conversation

cenedhryn
Copy link
Contributor

It's a big class and we'll need to add more tests.

@cenedhryn cenedhryn requested a review from a team as a code owner December 11, 2021 00:49
PRIMARY_CONTEXT,
null);
UpdateItemRequest.Builder expectedRequestBuilder = ddbRequestBuilder(ddbKey(item.getId(), item.getSort()));
expectedRequestBuilder.expressionAttributeValues(expectedValues);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I think it helps readability to chain the builder method calls together, rather than repeatedly reference expectedRequestBuilder. Same feedback for other locations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed... I stopped refactoring these types of tests after a while because I'll be adding quite a few similar ones, and I didn't want to end up having to back out of some optimization. I would like to simplify the handling of the updateExpression/expressionNames/expressionMaps/conditionals to a point where it's easy to glance at a test and quickly see the significant bits. Expect to see something in the next PR.

UpdateItemRequest request = updateItemOperation.generateRequest(FakeItemWithSort.getTableSchema(), PRIMARY_CONTEXT, null);


String expectedUpdateExpression = "SET " + OTHER_ATTRIBUTE_1_NAME + " = " + OTHER_ATTRIBUTE_1_VALUE +
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: As soon as we exceed a single concatenation operator, I usually find String.format(..) to be more readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, didn't love this setup either but again, because we're releasing support of the full range of UpdateExpression, there will be a lot of different types of expression strings so it'll be rectified when those are added.

@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 e7e2f65 into feature/master/ddbenhanced-updateexpression Dec 11, 2021
@cenedhryn cenedhryn deleted the salande/refactor-updateitem-tests branch December 11, 2021 19:13
aws-sdk-java-automation pushed a commit that referenced this pull request Feb 27, 2024
Revert "Support Non proxy host settings in the ProxyConfiguration for  Crt http client. (#4962)"
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.

2 participants