UTBotJava
UTBotJava copied to clipboard
Redundant brackets for mocks and class casts
Description
There are redundant brackets added around mock definitions. There are redundant brackets around class cast.
To Reproduce
- Install UnitTestBot plugin built from main in IntelliJ IDEA
- Open
spring-petclinic - Generate tests for
OwnerControllerclass - Check all
ownerRepositoryMockusages
Expected behavior
The whole expression should not be rounded with brackets. Class cast should have only required brackets, like following:
when(ownerRepositoryMock.findById(any())).thenReturn((Owner) null);
Actual behavior
There are redundant brackets added around expressions in mock definitions. There are redundant brackets when class cast is used.
Screenshots, logs
(when(ownerRepositoryMock.findById(any()))).thenReturn(((Owner) null));
Environment
IntelliJ IDEA version - CU/IU 2023.1 Project - Maven JDK - 1.8 / 17
Additional context
Actual for other projects