小休止

マシンがふっとんでしまったときに、TDDの写経もふっとんだので、
再度、見直して11章まで見直し。書き直し。

で、せっかくなので?やっと、JUNIT4でかいてみることに。

というわけではじめの一歩は。

import org.junit.Test;
import static org.junit.Assert.assertEquals;

import star.Dollar;
public class DollarTest {
    @Test public void testMultiplication() {
        Dollar five = new Dollar(5);
        five.times(2);
        assertEquals(10, five.amount);
    }
}

で、アサートは新しくクラスが用意さえれているし、
静的インポートもアレなので、こうした。

import org.junit.Test;
import org.junit.Assert;

import star.Dollar;
public class DollarTest {
    @Test public void testMultiplication() {
        Dollar five = new Dollar(5);
        five.times(2);
        Assert.assertEquals(10, five.amount);
    }
}

なんとなく?すっきり。
でも、Assertがなんか目立つようになった気もする。
あと、やっぱアノテーションってしっくりこないなぁ。
って、すごいいまさらな話。