- Notifications
You must be signed in to change notification settings - Fork 45
Closed
Labels
comp-codegenIssue is related to code generatorIssue is related to code generatorcomp-springIssue is related to Spring projects supportIssue is related to Spring projects supportctg-bugIssue is a bugIssue is a bug
Milestone
Description
Description
assertNull is applied to the method returned value, while it's method is mocked.
assertEquals to exact value is expected.
To Reproduce
- Install -IU- UnitTestBot plugin in IntelliJ IDEA
- Open
spring-petclinic - Set Fuzzing 100% mode
- Generate
Unit testsforPetTypeFormatterwithPetClinicApplicationconfiguration - Run the tests
Expected behavior
Method PetType$getName() is mocked with exact return value.
assertEquals for the actualName is expected.
Actual behavior
There is failing assertNull for actualName in successful test.
Screenshots, logs
@Test @DisplayName("parse: text = 'XZ', locale = Locale(String, String, String)") public void testParseWithNonEmptyString() throws ParseException { ArrayList arrayList = new ArrayList(); PetType petTypeMock = mock(PetType.class); (when(petTypeMock.getName())).thenReturn("XZ"); arrayList.add(petTypeMock); (when(ownerRepositoryMock.findPetTypes())).thenReturn(arrayList); Locale locale = new Locale("\n\t\r", "#$\\\"'", "#$\\\"'"); PetType actual = petTypeFormatter.parse("XZ", locale); String actualName = actual.getName(); assertNull(actualName); Integer actualId = actual.getId(); assertNull(actualId); }Environment
IntelliJ IDEA version - Community 2023.2
Project - Maven
JDK - 17
Metadata
Metadata
Assignees
Labels
comp-codegenIssue is related to code generatorIssue is related to code generatorcomp-springIssue is related to Spring projects supportIssue is related to Spring projects supportctg-bugIssue is a bugIssue is a bug
Type
Projects
Status
Done
