Skip to content

Do not suggest to test Kotlin protected methods #1280

Closed
@tyuldashev

Description

@tyuldashev

Description

UTBot suggests to generate tests for protected members of Kotlin class, but because they are visible only inside that class itself and its descendants the generated code cannot access such methods and fails at compilation.

To Reproduce

  1. In UTBot settings set Generated test language to Kotlin
  2. Invoke test generation for following class
class Calc {
    protected fun substract(a: Int, b: Int): Int {
        return a - b
    }
}

Expected behavior

UTBot either warn that there is NO methods it can test or create compilable code (if we can and want to access this method through reflection).

Actual behavior
UTBot allows to generate tests for that method and create uncompilable code.

Visual proofs (screenshots, logs, images)

image

image

Metadata

Metadata

Labels

comp-uiImprovements of plugin UI appearence and functionalityctg-bugIssue is a buglang-kotlinIssue is related to Kotlin language supportstatus-verifiedBug fix is verified

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions