Skip to content

Identical tests generated by ContestEstimator #1651

@alisevych

Description

@alisevych

Description

There are identical tests generated for io.seata.core.store.StoreMode.valueof in seata-core-0.5.0 with ContestEstimator.

To Reproduce

  1. Run the 'utbot' project in IntelliJ Idea 2022.2.4
  2. Open utbot-junit-contest/src/main/kotlin/org/utbot/contest/ContestEstimator.kt
  3. Change javaHome property to full local path to JDK 8
  4. In fun main change: projectFilter = listOf("seata-core-0.5.0")
  5. Run fun main - make sure to set JRE in Edit Configurations to JDK 8.
  6. When run is finished, check utbot-junit-contest/build/output/test/seata-core-0.5.0/io/seata/core/store/StoreModeTest.java

Expected behavior

Tests are supposed to be minimized - if several tests are covering same branches, only one should be present in resulting tests class.

Actual behavior

There are three identical tests on IllegalArgumentException for io.seata.core.store.StoreMode.valueof
Trying to call enum's method valueOf with abc, ab, h - while enum values are file, db.

Visual proofs (screenshots, logs, images)

Here is the generated test class:

package io.seata.core.store;

import org.junit.Test;

public final class StoreModeTest {
    ///region Test suites for executable io.seata.core.store.StoreMode.valueof
    
    ///region
    
    @Test(expected = IllegalArgumentException.class)
    public void testValueof1() {
        StoreMode.valueof("abc");
    }
    ///endregion
    
    ///endregion
    
    ///region Test suites for executable io.seata.core.store.StoreMode.valueof
    
    ///region
    
    @Test(expected = IllegalArgumentException.class)
    public void testValueof2() {
        StoreMode.valueof("ab");
    }
    ///endregion
    
    ///endregion
    
    ///region Test suites for executable io.seata.core.store.StoreMode.valueof
    
    ///region
    
    @Test(expected = IllegalArgumentException.class)
    public void testValueof3() {
        String string = "h";
        
        StoreMode.valueof(string);
    }
    ///endregion
    
    ///endregion
    
    ///region Test suites for executable io.seata.core.store.StoreMode.valueof
    
    ///region
    
    @Test(expected = IllegalArgumentException.class)
    public void testValueof4() {
        StoreMode.valueof(null);
    }
    ///endregion
    
    ///endregion
}

Environment

Windows 10 Pro
IntelliJ IDEA 2022.2.4
JDK 8

Metadata

Metadata

Assignees

Labels

comp-contest-estimatorIssue is related to contest estimatorcomp-minimizerIssue is related to Minimization phasectg-bugIssue is a bug

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions