Closed
Description
Description
Let's generate tests for the following code snippet
public UserServiceImpl(UserDao userDao) {
this.userDao = userDao;
}
@Transactional
@Override
public void add(User user) {
userDao.add(user);
}
The following test is generated
@Test
public void testListUsers_UserDaoListUsers_1() {
/* This test fails because method [web.service.UserServiceImpl.listUsers] produces [java.lang.NullPointerException]
web.service.UserServiceImpl.listUsers(UserServiceImpl.java:28) */
userServiceImpl.listUsers();
}
Actually, this test passes :)
And this behavior is correct because NPE is impossible on objects injected with Mock
and InjectMocks
.
Expected behavior
NPE tests should be generated only when this exception is really possible. We need to tune Symbolic engine for that.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done