NullPointerException in EmailServiceImplTest.sendNotificationByEmail
#429
Labels
bug
Something isn't working
EmailServiceImplTest.sendNotificationByEmail
#429
The test
EmailServiceImplTest.sendNotificationByEmail
fails with aNullPointerException
when callinguser.getLanguage().getCode()
in thesendNotificationByEmail
method ofEmailServiceImpl
.Cause
The issue occurs because the
User
object created in the test does not have aLanguage
specified. As a result,user.getLanguage()
returnsnull
, leading to the exception.Error Stack Trace
Steps to Reproduce
sendNotificationByEmail
test inEmailServiceImplTest
.NullPointerException
in the test output.Suggested Fix
Update the test
sendNotificationByEmail
to include aLanguage
object in theUser
builder. Replace:with:
This ensures that the
Language
object is notnull
and prevents theNullPointerException
.Additional Information
EmailServiceImpl
sendNotificationByEmail
EmailServiceImplTest
The text was updated successfully, but these errors were encountered: