GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Minimize exceptions in test methods signature · Issue #344 · UnitTestBot/UTBotJava

Minimize exceptions in test methods signature #344

New issue
Copy link
New issue
Copy link
Closed
#418
Closed
Minimize exceptions in test methods signature#344
#418
Copy link
Assignees
EgorkaKulikovsofurihafe
Labels
comp-codegenIssue is related to code generatorIssue is related to code generator

Description

@EgorkaKulikov
EgorkaKulikov
opened on Jun 29, 2022
Issue body actions

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
}

Activity

  1. EgorkaKulikov
    added
    comp-codegenIssue is related to code generatorIssue is related to code generator
    on Jun 29, 2022
  2. EgorkaKulikov
    self-assigned this
    on Jun 29, 2022
  3. EgorkaKulikov
    added this to UTBot Javaon Jun 29, 2022
  4. EgorkaKulikov
    moved this to Todo in UTBot Javaon Jun 29, 2022
  5. EgorkaKulikov commented on Jun 29, 2022

    @EgorkaKulikov
    EgorkaKulikov
    on Jun 29, 2022
    CollaboratorAuthor
    More actions
    public void testPDVisibleSignDesigner2() throws Exception, IOException

    Another example on the same class

  6. EgorkaKulikov commented on Jun 29, 2022

    @EgorkaKulikov
    EgorkaKulikov
    on Jun 29, 2022
    CollaboratorAuthor
    More actions
    public void testPageHeightByFuzzer7() throws Exception, ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
    
  7. EgorkaKulikov
    assigned
    sofurihafe
    on Jul 5, 2022
  8. EgorkaKulikov
    changed the title [-]Do not generate other throws in method signature if 'throws Throwable' is present.[/-] [+]Minimize exceptions in test methods signature[/+] on Jul 5, 2022
  9. EgorkaKulikov
    linked a pull request that will close this issueMinimize exceptions in signature #418on Jul 5, 2022
  10. EgorkaKulikov
    closed this as completedin #418on Jul 8, 2022
  11. Repository owner moved this from Todo to Done in UTBot Javaon Jul 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @EgorkaKulikov
    EgorkaKulikov
  • @sofurihafe
    sofurihafe

Labels

comp-codegenIssue is related to code generatorIssue is related to code generator

Type

No type

Projects

  • UTBot Java
    Status
    Done
    Show more project fields

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.