I am trying to write jnuit test classes for my class and attaching the screenshot below from debug view. Photoserialvalue is coming as null in my main class
Below is how i am trying to mock it.
Any leads on what is that I am missing? I am getting all other objects mocked and just this variable is coming as null. It is a Long type variable.
Any leads would be much appreciated.
Solved! Go to Solution.
Views
Replies
Total Likes
Was able to fix the issue. Removed the null initialisation for the variable photoSerialValue and then it was picking the value from the mocked class.
Hello @P_V_Nair
When you are trying to mock, its defined as
But, when validating, it is:
Could we please try by using the same get() method in both places (Long.class as second param) ?
hi @P_V_Nair ,
As you have mentioned long.class then you don't to typecast.
photoSerialValue = properties.get(Constant.PHOTO_SERIAL_ID, Long.class);
Hope this helps.
Thanks,
Nikita Garg
I tried with another property of the same value map , but it is string value and it is populated with the right value. Only for this long property, it is coming as null
Was able to fix the issue. Removed the null initialisation for the variable photoSerialValue and then it was picking the value from the mocked class.
Views
Likes
Replies
Views
Likes
Replies