I am writing test cases for a Java class. It contains an exception case also where the exception is thrown when response from server is not as expected.
I am bit confused about the name of that test method.
The method is Book updateBook(Book book);
It throws some exception when right response is not received.
For that, I have written a unit test case. But I am not sure what format should I follow for correct naming of that test method.
Should I name it
testThrowExceptionWhenResponseIsNull();
OR
shouldThrowExceptionWhenBookManagementIsNull();
I would prefer
updateBookThrowsExceptionWhenBookManagementIsNull
It names which method is under test and the asserted result for which condition.
But choose a name which is fitting for you und your colleagues.