samples/individualsamples/src/org/apidesign/samples/CodeThatCanBeCalledOnlyByTest.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Thu, 30 Oct 2014 20:46:27 +0100
changeset 408 9a439a79c6d0
parent 143 20dad4daf81b
permissions -rw-r--r--
Use scala 2.10.4 to compile on JDK8
     1 package org.apidesign.samples;
     2 
     3 public class CodeThatCanBeCalledOnlyByTest {
     4     private static int number;
     5 
     6     public static int getNumber() {
     7         return number;
     8     }
     9     
    10     public static void setNumber(int n) {
    11         // BEGIN: call.only.by.test
    12         boolean assertionsOn = false;
    13         assert assertionsOn = true;
    14         if (!assertionsOn) {
    15             throw new IllegalStateException("This is a testing method only!");
    16         }
    17         // END: call.only.by.test
    18         number = n;
    19     }
    20 }