| | package com.sample; |
---|
| | |
---|
| | import org.junit.Test; |
---|
| | import org.junit.Before; |
---|
| | import static org.junit.Assert.*; |
---|
| | import static org.hamcrest.CoreMatchers.*; |
---|
| | |
---|
| | |
---|
| | /** |
---|
| | * Unit test for simple App. |
---|
| | */ |
---|
| | public class App2Test |
---|
| | { |
---|
| | private App2 app2; |
---|
| | |
---|
| | /** |
---|
| | * オブジェクトを初期化。 |
---|
| | */ |
---|
| | @Before |
---|
| | public void setUp(){ |
---|
| | System.out.println("setup()"); |
---|
| | app2 = new App2(); |
---|
| | } |
---|
| | |
---|
| | /** |
---|
| | * 3 × 5 = 15 であること |
---|
| | */ |
---|
| | @Test |
---|
| | public void case1() |
---|
| | { |
---|
| | assertThat(app2.mul(3, 5), is(15)); |
---|
| | } |
---|
| | |
---|
| | /** |
---|
| | * 3 × 0 = 0 であること |
---|
| | */ |
---|
| | @Test |
---|
| | public void case2() |
---|
| | { |
---|
| | assertThat(app2.mul(3, 0), is(0)); |
---|
| | } |
---|
| | } |
---|
| | |
---|
|