samples/codeinjection/test/org/apidesign/codeinjection/Version10Test.java
author Jaroslav Tulach <jtulach@netbeans.org>
Sat, 10 Jan 2009 21:29:22 +0100
changeset 303 77b6002451c4
child 305 e6b3dc7d5795
permissions -rw-r--r--
Initial version of sample to explain 'code injection'
     1 /*
     2  * To change this template, choose Tools | Templates
     3  * and open the template in the editor.
     4  */
     5 
     6 package org.apidesign.codeinjection;
     7 
     8 import org.junit.Test;
     9 import static org.junit.Assert.*;
    10 
    11 /** Final count down test.
    12  *
    13  * @author Jaroslav Tulach <jtulach@netbeans.org>
    14  */
    15 public class Version10Test {
    16 
    17     public Version10Test() {
    18     }
    19 
    20     /** creates version 1.0 */
    21     private static CountDown create(int value) {
    22         return new CountDownImplV1(value);
    23     }
    24 
    25     @Test
    26     public void testDecrementFourTimes() {
    27         CountDown counter = create(4);
    28         assertFalse("Not down yet", counter.isDown()); counter.down();
    29         assertFalse("Not down yet", counter.isDown()); counter.down();
    30         assertFalse("Not down yet", counter.isDown()); counter.down();
    31         assertFalse("Not down yet", counter.isDown()); counter.down();
    32         assertTrue("Down now", counter.isDown());
    33     }
    34 }