vligleercg
New Member
I read the Oracle recommendations concerning Java's assert and it says that you should use assert for public postconditions, too(http://docs.oracle.com/javase/1.4.2/docs/guide/lang/assert.html#postconditions).How would I combine this assert with a automated test, that actually does this check, too?Example:After invoking the "push" method of a class "Stack" you want to check whether the stack is now not empty. You can use assert and you can use a test.Is there any best practice, I could do both and the unit test with some more checks, but anyhow I would do things twice, which seems not to be good.I have already read these questions:http://programmers.stackexchange.com/questions/18288/are-asserts-or-unit-tests-more-importantassert vs. JUnit Assertions