Skip to main content

New answers tagged

2 votes

Is integration-testing all services the best approach?

This is a "should" question, which necessarily is going to be answered by "It depends" - especially when it comes to testing. Despite what some zeaolots advocate, there really is ...
Jeremy French's user avatar
5 votes

Is integration-testing all services the best approach?

each class should have a unit test This is not strictly true. There is little value in assertions such as “each method should be covered” or “we should have 95% branch coverage.” If you have parts of ...
Arseni Mourzenko's user avatar
0 votes

Is it good practice to check exception messages in unit tests?

If it is necessary for a function to fail in some case, it is a good idea to test that. However, since the specific text should not affect the behavior of the caller of the function, it is not a good ...
VLL's user avatar
  • 101
0 votes

Is it good practice to check exception messages in unit tests?

In your case, the dynamic and important part of the message is a parameter name: Assertions.assertContains("last", exception.getMessage()); This does not require the extremes Arseni ...
Basilevs's user avatar
  • 4,507
10 votes

Is it good practice to check exception messages in unit tests?

From my own personal experience, you should only be building unit tests for things that you do not want anyone to change without also modifying the unit tests. That might seem tautological so I'll ...
JimmyJames's user avatar
  • 31.1k
3 votes

Is it good practice to check exception messages in unit tests?

There is a hierarchy of value in testing. Do the cases you expect to work, work correctly Do the cases you expect to fail, fail without mucking stuff up When you throw an exception for a failed case, ...
Ewan's user avatar
  • 84.6k
5 votes

Is it good practice to check exception messages in unit tests?

A string is equal to itself A developer could later make a trivial change to the message, such as “last name must not be null” and this would break the unit tests, even though the message's meaning ...
Arseni Mourzenko's user avatar

Top 50 recent answers are included