Reputation: 15874
We have a non-concurrent
java snippet to generate jwt token and now need to write JUnit
for the same.
There are few queries about this :
concurrent junit
for non-concurrent code
?JUnit
in that except the normal flow? as there is not shared/mutable
property.Upvotes: 3
Views: 139
Reputation: 2438
I think the term you are looking for is probably - 'thread safety'.
if you need to prove the code works in a multi-threaded scenario
yes it should be tested
if the code (class / object) is 'stateless' - the tests should be simpler -validate that output is only input or non-shared time/nonce based.
(you haven't shared code - so this is a general answer.
In your case if jwt token is being created - implies that - concurrent invocation will returns different token values. hence the assertions should confirm the same. )
Upvotes: 4