Was this a reverted condition? It seems that a code that can only be called be a test needs to be allowed when assertions are on.
authorJaroslav Tulach <jtulach@netbeans.org>
Wed, 08 Aug 2012 23:55:35 +0200
changeset 39906362e8bbcd9
parent 398 b87fd959548b
child 400 f0a7e800323c
Was this a reverted condition? It seems that a code that can only be called be a test needs to be allowed when assertions are on.
When assertions are off, it should throw IllegalStateException. Right?
samples/individualsamples/src/org/apidesign/samples/CodeThatCanBeCalledOnlyByTest.java
     1.1 --- a/samples/individualsamples/src/org/apidesign/samples/CodeThatCanBeCalledOnlyByTest.java	Wed Aug 08 23:25:59 2012 +0200
     1.2 +++ b/samples/individualsamples/src/org/apidesign/samples/CodeThatCanBeCalledOnlyByTest.java	Wed Aug 08 23:55:35 2012 +0200
     1.3 @@ -11,7 +11,7 @@
     1.4          // BEGIN: call.only.by.test
     1.5          boolean assertionsOn = false;
     1.6          assert assertionsOn = true;
     1.7 -        if (assertionsOn) {
     1.8 +        if (!assertionsOn) {
     1.9              throw new IllegalStateException("This is a testing method only!");
    1.10          }
    1.11          // END: call.only.by.test