You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test(amazon Q): fix test failure caused by MockTelemetryExtension throwing NotAMockException (#5258)
## Description
<!--- Describe your changes in detail -->
<!--- If appropriate, providing screenshots will help us review your contribution -->
<!--- If there is a related issue, please provide a link here -->
Now there are 2 ways to use NoOpTelemetryService
1. if devs are not interested in validating the metric contents, don't need do anything as default test implementation is NoOpTelemetryService
2. if devs are interested in the metric contents, can use `MockTelemetryServiceExtension` which will inject a spy of batcher and replace the original test implementation in junit before hook and revert it in after hook so that you can use ArgumentCaptor to capture what's going through the batcher
Relevant #5207
### root cause:
Originally by doing `class NoOpTelemetryService : TelemetryService(publisher, spy(DefaultTelemetryBatcher(publisher))) {`, it's not 100% guaranteed that the TelemetryBatcher passed in is a mockito spy, and it result in `NotAMockException` thrown from these cases.
### solution
Manually inject spy batcher separately in a different step instead of IDE doing the work when initializing app/project service components---------
Co-authored-by: Richard Li <[email protected]>
Copy file name to clipboardExpand all lines: plugins/core/jetbrains-community/tstFixtures/software/aws/toolkits/jetbrains/services/telemetry/MockTelemetryService.kt
0 commit comments