-
Notifications
You must be signed in to change notification settings - Fork 45
Closed
Labels
comp-summariesSomething related to the method names, code comments and display names generationSomething related to the method names, code comments and display names generationctg-bugIssue is a bugIssue is a bugspec-customerIssues from customersIssues from customers
Description
Description
Code snippet inside Java docs is rendered incorrectly which corrupts the whole test class.
Reproduces only for a certain static method inside final class.
To Reproduce
- Run the 'lrs' project in IntelliJ Idea 2022.2.4
- Use plugin to generate tests - version from main branch after release 2022.12 was used
- Generate tests with UnitTestBot for
LongRangeUtil.remainderor for the following code:
final class A {
/**
* Returns the .
* Ttt
* Tta
*
* @param a a
* @param b b, ...
* @return the result.
*/
static int result(long a, int b) {
a = a % b;
return (int) (a < 0 ? a + b : a);
}
}- Open the generated test
Expected behavior
Suggest not to include Java docs in code quote.
The summaries should be the same as if there is not Java docs in the source code.
Actual behavior
Code snippet in Java docs is prefaced with */ - so it is out of Java docs.
Thus the whole test class is not compiling.
Visual proofs (screenshots, logs, images)
public final class ATest {
///region Test suites for executable com.intellij.util.A.result
///region SYMBOLIC EXECUTION: SUCCESSFUL EXECUTIONS for method result(long, int)
/**
* @utbot.classUnderTest {@link A}
* @utbot.methodUnderTest {@link A#result(long, int)}
* @utbot.returnsFrom {@code return (int) (a < 0 ? a + b : a);}
*/
@Test
@DisplayName("result: return (int) (a < 0 ? a + b : a) : False -> return (int) (a < 0 ? a + b : a)")
public void testResult_A0aba() {
int actual = A.result(-252L, 252);
assertEquals(0, actual);
}
/**
@utbot.classUnderTest {@link A}
* @utbot.methodUnderTest {@link A#result(long, int)}
* @utbot.returnsFrom {@code
*
static int result(long a, int b) {
*a = a % b;
*return (int) (a < 0 ? a + b : a);
*}
}
**/
@Test
@DisplayName("result: return (int) (a < 0 ? a + b : a) : True -> /** * Returns the . * Ttt * Tta * * @param a a * @param b b, ... * @return the result. */ static int result(long a, int b) { a = a % b return (int) (a < 0 ? a + b : a) }")
public void testResult_A0aba_1(){
int actual=A.result(-128L,129);
assertEquals(1,actual);
}
///endregion
///region SYMBOLIC EXECUTION: ERROR SUITE for method result(long, int)
/**
* @utbot.classUnderTest {@link A}
* @utbot.methodUnderTest {@link com.intellij.util.A#result(long, int)}
* @utbot.throwsException {@link java.lang.ArithmeticException} in: a = a % b;
*/
@Test
@DisplayName("result: a = a % b -> ThrowArithmeticException")
public void testResult_ThrowArithmeticException(){
/* This test fails because method [com.intellij.util.A.result] produces [java.lang.ArithmeticException: / by zero]
com.intellij.util.A.result(A.java:15) */
A.result(1L,0);
}
///endregion
///endregion
}Environment
Windows 10 Pro
IntelliJ IDEA 2022.2.4
IntelliJ project
JDK 11
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
comp-summariesSomething related to the method names, code comments and display names generationSomething related to the method names, code comments and display names generationctg-bugIssue is a bugIssue is a bugspec-customerIssues from customersIssues from customers
Type
Projects
Status
Done