question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
alzimmermsftcommented, Aug 21, 2019

@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.

0reactions
msftbot[bot]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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unit testing and mocking with Azure SDK .NET
To create a test client instance, inherit from the client type and override methods you are calling in your code with an implementation...
Read more >
How to mock a final class with mockito - java - Stack Overflow
Mockito checks the extensions directory for configuration files when it is loaded. This file enables the mocking of final methods and classes. Save...
Read more >
Java Azure SDK Design Guidelines
A service client designation is only applied to classes that are able to be ... For example, a blob storage library developer may...
Read more >
Spring Boot Reference Documentation
Build tool plugins: Maven | Gradle. Appendix: Application Properties | Configuration Metadata | Auto-configuration Classes | Test Auto-configuration Annotations ...
Read more >
AZ-204 exam questions for FREE | Azure Developing solutions
The AZ-204 practice test covers all the topics you need to know for the AZ-204 exam, and it ... Process the messages and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found