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'
jtulach@303
     1
/*
jtulach@303
     2
 * To change this template, choose Tools | Templates
jtulach@303
     3
 * and open the template in the editor.
jtulach@303
     4
 */
jtulach@303
     5
jtulach@303
     6
package org.apidesign.codeinjection;
jtulach@303
     7
jtulach@303
     8
import org.junit.Test;
jtulach@303
     9
import static org.junit.Assert.*;
jtulach@303
    10
jtulach@303
    11
/** Final count down test.
jtulach@303
    12
 *
jtulach@303
    13
 * @author Jaroslav Tulach <jtulach@netbeans.org>
jtulach@303
    14
 */
jtulach@303
    15
public class Version10Test {
jtulach@303
    16
jtulach@303
    17
    public Version10Test() {
jtulach@303
    18
    }
jtulach@303
    19
jtulach@303
    20
    /** creates version 1.0 */
jtulach@303
    21
    private static CountDown create(int value) {
jtulach@303
    22
        return new CountDownImplV1(value);
jtulach@303
    23
    }
jtulach@303
    24
jtulach@303
    25
    @Test
jtulach@303
    26
    public void testDecrementFourTimes() {
jtulach@303
    27
        CountDown counter = create(4);
jtulach@303
    28
        assertFalse("Not down yet", counter.isDown()); counter.down();
jtulach@303
    29
        assertFalse("Not down yet", counter.isDown()); counter.down();
jtulach@303
    30
        assertFalse("Not down yet", counter.isDown()); counter.down();
jtulach@303
    31
        assertFalse("Not down yet", counter.isDown()); counter.down();
jtulach@303
    32
        assertTrue("Down now", counter.isDown());
jtulach@303
    33
    }
jtulach@303
    34
}