Skip to content

Minimize exceptions in test methods signature #344

Closed
@EgorkaKulikov

Description

@EgorkaKulikov

Description

The generated tests code looks as follows:

 public void testSetImage2() throws Throwable, Exception  { ... }

Throwing both Exception and Throwable is odd.
Can be reproduced with ContestEstimator on PDVisibleSignDesigner , method setImage

Expected behavior

The signature looks like

  1. if Throwable is really required
 public void testSetImage2() throws Throwable { ... } 
  1. if throwable is really not required
 public void testSetImage2() throws Exception  { ... }

Context

Possibly the reason of this problem is in

//If [InvocationTargetException] is thrown manually in test, we 
// to add "throws Throwable" and other exceptions are not required so on.
if (methodId == getTargetException) {
        collectedExceptions.clear()
        addException(Throwable::class.id)
        return
}

Metadata

Metadata

Labels

comp-codegenIssue is related to code generator

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions