I have the following simplified code
class Foo() {
suspend fun bar() {
val headers = AtomicReference(Metadata())
val metadata = headers.get()
if (metadata.keys().size > 0) { // I want it to return a value specified in the test file
// ...
}
}
How can I mock AtomicReference
or Metadata
so that for example headers.get().keys().size
returns a specified value and not the real one?