Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

100% branch coverage cannot be met when the suspend method return value is kotlin.Result #1868

Copy link
Copy link
Open
@gkj17

Description

@gkj17
Issue body actions
  • JaCoCo version: 0.8.12.202403310830
  • Operating system: Windows11
  • Tool integration: Maven
  • Complete executable reproducer:
// kotlin code
suspend fun process(scenarioId: Int, trigger: Int): Result<Unit>

process(
     scenarioId = //anyIntValue,
     trigger = //anyIntValue
)
// UT code

// case1
coEvery {
    scenarioStateDispatcher.process(any(), any())
}.returns(Result.success(Unit))

// case2
coEvery {
    scenarioStateDispatcher.process(any(), any())
}.returns(Result.failure(Exception("test Exception")))

  • Steps: (what exactly are you doing with the above reproducer?)
    I want the process method to implement 100% branch coverage.

Expected behaviour

100% branch coverage of process method.

Actual behaviour

1 of 2 branches missed.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

To Do
Show more project fields

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.