Closed
Description
Description
We generates wrong JavaDocs for Fuzzing Tests for the example with the nested classes
To Reproduce
- Run the snippet of code in IntelliJ Idea
- Run plugin via runIde
- Disable Symbolic in the Settings Panel (Fuzzing = 100 %, Symbolic = 0 %)
- Use plugin to generate tests
Snippet of code to generate:
package custom.inner;
public class DeepNested {
public class Nested1 {
public class Nested2 {
public int f(int i) {
if (i > 0) {
return 10;
}
return 0;
}
}
}
}
The given tests:
package custom.inner;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.DisplayName;
import custom.inner.DeepNested.Nested1.Nested2;
import custom.inner.DeepNested.Nested1;
import static org.utbot.runtime.utils.java.UtUtils.createInstance;
import static org.junit.jupiter.api.Assertions.assertEquals;
public final class DeepNestedTest {
///region Tests for Nested1
@Nested
public final class Nested1Test {
///region Tests for Nested2
@Nested
public final class Nested2Test {
///region Test suites for executable custom.inner.DeepNested$Nested1$Nested2.f
///region
/**
* @utbot.classUnderTest {@link custom.inner.DeepNested.Nested1.Nested2}
* @utbot.methodUnderTest {@link custom.inner.DeepNested.Nested1.Nested2#f(int)}
*/
@Test
@DisplayName("f: i = 0 -> return 0")
public void testFReturnsZeroWithCornerCase() throws Exception {
Nested2 nested2 = ((Nested2) createInstance("custom.inner.DeepNested$Nested1$Nested2"));
int actual = nested2.f(0);
assertEquals(0, actual);
}
/**
* @utbot.classUnderTest {@link custom.inner.Nested2}
* @utbot.methodUnderTest {@link custom.inner.Nested2#f(int)}
*/
@Test
@DisplayName("f: i = 134217728 (mutated from 0) -> return 10")
public void testFReturns10() throws Exception {
Nested2 nested2 = ((Nested2) createInstance("custom.inner.DeepNested$Nested1$Nested2"));
int actual = nested2.f(134217728);
assertEquals(10, actual);
}
///endregion
///region FUZZER: SUCCESSFUL EXECUTIONS for method f(int)
/**
* @utbot.classUnderTest {@link custom.inner.Nested2}
* @utbot.methodUnderTest {@link custom.inner.Nested2#f(int)}
*/
@Test
@DisplayName("f: f: i = 0 -> return 0")
public void testFReturnsZeroWithCornerCase1() throws Exception {
Nested2 nested2 = ((Nested2) createInstance("custom.inner.DeepNested$Nested1$Nested2"));
int actual = nested2.f(0);
assertEquals(0, actual);
}
/**
* @utbot.classUnderTest {@link custom.inner.Nested2}
* @utbot.methodUnderTest {@link custom.inner.Nested2#f(int)}
*/
@Test
@DisplayName("f: f: i = 134217728 (mutated from 0) -> return 10")
public void testFReturns101() throws Exception {
Nested2 nested2 = ((Nested2) createInstance("custom.inner.DeepNested$Nested1$Nested2"));
int actual = nested2.f(134217728);
assertEquals(10, actual);
}
///endregion
///endregion
}
///endregion
}
///endregion
}
Expected behavior
JavaDocs with the resolved links should be generated.
Actual behavior
Some links don't contain the full path to the nested class, middle information is lost or erased.
Visual proofs (screenshots, logs, images)
Should be like on the screen below:
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done