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 — Unexpected tests for some inherited methods on enums · Issue #457 · UnitTestBot/UTBotJava

Unexpected tests for some inherited methods on enums #457

New issue
Copy link
New issue
Copy link
Closed
#505
Closed
Unexpected tests for some inherited methods on enums#457
#505
Copy link
Assignees
volivan239
Labels
comp-symbolic-engineIssue is related to the symbolic execution engineIssue is related to the symbolic execution enginectg-bugIssue is a bugIssue is a bug

Description

@sofurihafe
sofurihafe
opened on Jul 8, 2022
Issue body actions

Description

Generated tests for enum contain methods testing valueOf

To Reproduce

  1. Run Contest Estimator with method com.google.common.base.CaseFormat.* and 300s time limit.

Actual behavior

Generated tests contain the following:

    @Test
    //@org.junit.jupiter.api.DisplayName("valueOf: arg_0 = blank string -> throw IllegalArgumentException")
    public void testValueOfThrowsIAEWithBlankString() {
        /* This test fails because executable under testing com.google.common.base.CaseFormat.valueOf
        produces Runtime exception java.lang.IllegalArgumentException: No enum constant com.google.common.base.CaseFormat.    */
        CaseFormat.valueOf("   ");
    }

    @Test
    //@org.junit.jupiter.api.DisplayName("valueOf: arg_0 has special characters -> throw IllegalArgumentException")
    public void testValueOfThrowsIAEWithBlankString1() {
        /* This test fails because executable under testing com.google.common.base.CaseFormat.valueOf
        produces Runtime exception java.lang.IllegalArgumentException: No enum constant com.google.common.base.CaseFormat.
	
 */
        CaseFormat.valueOf("\n\t\r");
    }

Activity

  1. sofurihafe
    added
    ctg-bugIssue is a bugIssue is a bug
    comp-symbolic-engineIssue is related to the symbolic execution engineIssue is related to the symbolic execution engine
    on Jul 8, 2022
  2. sofurihafe
    assigned
    dtim
    on Jul 8, 2022
  3. sofurihafe
    added this to UTBot Javaon Jul 8, 2022
  4. sofurihafe
    moved this to Todo in UTBot Javaon Jul 8, 2022
  5. EgorkaKulikov commented on Jul 8, 2022

    @EgorkaKulikov
    EgorkaKulikov
    on Jul 8, 2022
    Collaborator
    More actions

    This behaviour can also be reproduced on equals and hashCode methods.

  6. EgorkaKulikov
    changed the title [-]Unexpected tests for valueOf on enums[/-] [+]Unexpected tests for some inherited methods on enums[/+] on Jul 8, 2022
  7. dtim commented on Jul 8, 2022

    @dtim
    dtim
    on Jul 8, 2022
    Collaborator
    More actions

    It seems that tests for Enum::valueOf(String) and Enum::values() are correct by themselves: these methods are not inherited but generated by the compiler as a part of a specific enum class. At the same time they are redundant, as they test the generated code on that users do not have any control.

  8. dtim commented on Jul 12, 2022

    @dtim
    dtim
    on Jul 12, 2022
    Collaborator
    More actions

    My opinion: we should generate tests for overridden hashCode, equals, toString etc (including anonymous classes), but not to generate tests for inherited methods where no user-defined implementation is present in the class under test.

    TODO: check if tests are generated for inherited methods without user-defined implementation.

  9. dtim
    assigned
    volivan239
    and unassigned
    dtim
    on Jul 12, 2022
  10. volivan239
    closed this as completedin #505on Jul 18, 2022
  11. volivan239
    added a commit that references this issue on Jul 18, 2022

    Disable tests for autogenerated functions #457 (#505)

    ff1ea73
  12. Repository owner moved this from Todo to Done in UTBot Javaon Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @volivan239
    volivan239

Labels

comp-symbolic-engineIssue is related to the symbolic execution engineIssue is related to the symbolic execution enginectg-bugIssue is a bugIssue is a bug

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 01402520 — 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.