-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Is there any semantic difference between writing
assertThat(object1, is(equalTo(object2)));
and writing
assertThat(object1, equalTo(object2)));
? If not, I would prefer the first version, because it reads better. Are there any other considerations here?
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Can anybody explain (or suggest a site or paper) the exact difference between triggers, assertions and checks, and also describe where I should use them?
EDIT: I mean in database, not in any other system or language.
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I do some checking of arguments in my classes in php using exception-throwing functions. I have functions that do a basic check ( ===, in_array etc ) and throw an exception on false. So I can do assertNumeric($argument, "\$argument is not numeric."); instead of
if ( ! is_numeric($argument) ) {
…
>>> More
-
as seen on Programmers
- Search for 'Programmers'
Just like the question asks, is there a need to add Debug.Assert into your code if you are writing unit tests (which has its own assertions)? I could see that this might make the code more obvious without having to go into the tests, however it just seems that you might end up with duplicated asserts…
>>> More
-
as seen on Programmers
- Search for 'Programmers'
Lately I have been struggling to understand what the right amount of checking is and what the proper methods are.
I have a few questions regarding this:
What is the proper way to check for errors (bad input, bad states, etc)? Is it better to explicitly check for errors, or use functions like asserts…
>>> More