You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the following class under test. I generated tests for a line return a + b within add method and the prompt was as follows:
classCalcKotlinCtor {
val a =10funadd(a:Int, b:Int): Int {
return a + b
}
}
Generate unit tests in kotlin for the line `return a + b` within `org.example.CalcKotlinCtor.add` in the following code:
```
[Instruction]: Use a default constructor with zero arguments to instantiate `org.example.CalcKotlinCtor` and call the method under test `add`:
Constructors of the class org.example.CalcKotlinCtor:
=== Default constructor
Method:
fun add(a: Int, b: Int): Int {
return a + b
}
```
Dont use @Before and @After test methods.
Make tests as atomic as possible.
All tests should be for JUnit 4.
In case of mocking, use Mockito 5. But, do not use mocking for all tests.
Name all methods according to the template - [MethodUnderTest][Scenario]Test, and use only English letters.
Here are some information about other methods and classes used by the class under test. Only use them for creating objects, not your own ideas.
=== methods in org.example.CalcKotlinCtor:
- fun add(a: Int, b: Int): Int
=== methods in org.example.CalcKotlinCtor:
- fun add(a: Int, b: Int): Int
=== methods in org.example.CalcKotlinCtor:
- fun add(a: Int, b: Int): Int
The prompt template used for the reproduction is:
Generate unit tests in $LANGUAGE for $NAME to achieve100% line coverage forthisclass.
Dont use @Before and @After test methods.
Make tests as atomic as possible.
All tests should be for$TESTING_PLATFORM.
In case of mocking, use$MOCKING_FRAMEWORK. But, do not use mocking for all tests.
Name all methods according to the template - [MethodUnderTest][Scenario]Test, and use only English letters.
DONOTuse raw tests for both Kotlin and Java. Create normal functions only.
The source code of class under test is as follows:
$CODE$METHODS$POLYMORPHISM$TEST_SAMPLE
As you see, the === methods in org.example.CalcKotlinCtor block triplicates. I reproduced it for Kotlin but Java might have been affected as well.
To Reproduce
Steps to reproduce the behavior:
Use the provided CUT and execute test generation for a line.
See the prompt that contains triplication.
Expected behavior
No data triplication.
The text was updated successfully, but these errors were encountered:
Describe the bug
I have the following class under test. I generated tests for a line
return a + b
withinadd
method and the prompt was as follows:The prompt template used for the reproduction is:
As you see, the
=== methods in org.example.CalcKotlinCtor
block triplicates. I reproduced it for Kotlin but Java might have been affected as well.To Reproduce
Steps to reproduce the behavior:
Expected behavior
No data triplication.
The text was updated successfully, but these errors were encountered: