While powerful, the problem with Java assertions is that they must be
explicitly enabled (e.g. with the JVM switch, -ea), as Jake already pointed
out, which makes them dangerous to rely on.
Additionally, in general, there is nothing about Assertions that require
they only be used for testing purpo
org.apache.geode.internal.Assert was introduced as a temporary stand-in for
Java assertions when GemFire was built using a version of JDK that was
pre-assertions. I think we probably should plan to delete it whether we use
assertions or not.
On Thu, Jul 19, 2018 at 1:07 PM, Udo Kohlmeyer wrote:
+1 to what Anthony said. If you need to assert that you have received
the data or even that it is in the correct format, you are missing to
validations and service/method contract.
Assert, be it Java or JUnit, should really be for testing only. The
code/methods/functions/services should protec
I’m not a fan of assertions in product code. Usually it’s a sign of missing
error handling. Crashing a geode server when an unexpected condition is
encountered is usually not the right thing.
Anthony
> On Jul 18, 2018, at 8:18 PM, Jacob Barrett wrote:
>
> There is a HUGE difference between
+💯 to what Jake said.
Java language asserts are a crutch that enables you to get what you think
you want from your tests without getting any of the design feedback which
is where I see the main benefit of unit tests and TDD. These asserts are a
honey pot that makes it easier for developers to do t
There is a HUGE difference between Java language assert and an class called
Assert.
Java language asserts are disabled at runtime by default. They should only be
used for testing assertions when running in a “Test” mode. Since under such
conditions you should have good unit test doing the same
dont know what other people do, but I do not use assertions in production
code. in test code, I like to use assertJ whenever possible since it
provide more convenience methods and more descriptive failure messages than
junit assert.
On Wed, Jul 18, 2018, 6:52 PM Galen O'Sullivan
wrote:
> Hi all,
Hi all,
I'm wondering what the collective's opinion of assertions is. I notice
there's an org.apache.geode.internal.Assert class, which is used some
places, and that plain old Java assertions are used in other places. Can we
remove one of these and use the other? Should we be including assertions