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

[Azure Blob Storage SDK] Client classes marked as final - making them unable to mock #5051

Closed
Silvatre opened this issue Aug 20, 2019 · 6 comments
Labels
Azure.Core azure-core Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization.

Comments

@Silvatre
Copy link

Silvatre commented Aug 20, 2019

Hi,

Most (if not all) of the Azure Blob Storage SDK clients are marked as final, making it not possible (or overcomplicated) to write the tests with mocked client layer (e.g. with Mockito) - which seems to be a common use case.

Version

<dependency>
    <groupId>com.azure</groupId>
    <artifactId>azure-storage-blob</artifactId>
    <version>12.0.0-preview.2</version>
</dependency>

Solution
Make the client classes non-final or provide client interfaces.

@kaerm kaerm added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Storage Storage Service (Queues, Blobs, Files) labels Aug 20, 2019
@rickle-msft
Copy link
Contributor

@Silvatre. Thank you for bringing this to our attention.

@JonathanGiles Can you please give us some guidance for how to support mocking scenarios and still be within Azure SDK guidelines?

@alzimmermsft
Copy link
Member

@Silvatre #5017 has discussions and potential solutions for mocking. It is missing direct mention for mocking final class and clients, I will work with @srnagar to add recommendations for those cases.

@alzimmermsft
Copy link
Member

@Silvatre, did the linked issue have enough documentation to help alleviate the classes being marked as final issue?

@alzimmermsft alzimmermsft removed the Storage Storage Service (Queues, Blobs, Files) label Sep 24, 2019
@alzimmermsft
Copy link
Member

Removing the Storage label as this is an issue that spans across our SDK offerings.

@alzimmermsft alzimmermsft removed their assignment Sep 24, 2019
@joshfree joshfree added Storage Storage Service (Queues, Blobs, Files) Azure.Core azure-core and removed Storage Storage Service (Queues, Blobs, Files) labels Oct 17, 2019
@joshfree
Copy link
Member

Resolving as a duplicate of #5017

@Silvatre please feel free to add more comments or reactivate if needed; otherwise we will use #5017 to continue to track mocking support

@ghost
Copy link

ghost commented Oct 17, 2019

Thanks for working with Microsoft on GitHub! Tell us how you feel about your experience using the reactions on this comment.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Core azure-core Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization.
Projects
None yet
Development

No branches or pull requests

5 participants