aws / aws/amazon-q-developer-cli

Q CLI does not know how to mock a Kotlin companion method correctly and tries a bunch of options that don't work instead of using search tools for insight

Open
#1,957 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2k
Forks
439
PR merge metrics
No merged PRs in 30d

Description

### Checks

- [x] I have searched [github.com/aws/amazon-q-developer-cli/issues](https://github.com/aws/amazon-q-developer-cli/issues?q=) and there are no duplicates of my issue

### Operating system

macOS 15.4.1 (24E263)

### Expected behaviour

That Q CLI would know best practices for Kotlin testing e.g. using MockK like https://github.com/mockk/mockk/issues/136#issuecomment-419879755 and https://medium.com/@ttlnews/how-to-mock-a-kotlin-static-companion-method-using-mockk-e4cf58607844 and that it would try options that work. I would expect it to consider searching live documentation and issues in situations it was inadequately trained.

### Actual behaviour

Q CLI spun around trying a bunch of options that don't work, until I found and told it the answer.

### Steps to reproduce

1. Write a KT class Foo with a Companion method
2. Write a unit test that tries to operate on that method.
3. Observe that, at least for myself, Q CLI never reaches for mockkObject(Foo.Companion), though it is documented to work. It instead tries a bunch of different options that don't work.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.