samples/individualsamples/src/org/apidesign/samples/CodeThatCanBeCalledOnlyByTest.java
author Jaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Jun 2008 09:57:12 +0200
changeset 143 20dad4daf81b
child 399 06362e8bbcd9
permissions -rw-r--r--
Special project for inidividual samples, used to show code that can be called only from test
     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 }