I think the test framework expects the exception to be raised inside setValue()
and not inside the listener. Try to move the code of the listener to a separate function and use this function in assertThrows()
. Why do you validate the values inside a test? Shouldnât it be validated inside the logic?