diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2017-02-20 10:33:44 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2017-02-20 10:33:44 +0100 |
commit | 25bf80f2c6c3c6784f78d9d41b5e38a5273a00fe (patch) | |
tree | e0125ce43205e48c0b14faacca248e58037e6479 /java/project/src/test | |
parent | 348663665082107181968a76fd14c2491b4f51e2 (diff) | |
download | share-25bf80f2c6c3c6784f78d9d41b5e38a5273a00fe.zip share-25bf80f2c6c3c6784f78d9d41b5e38a5273a00fe.tar.gz |
java : add project (ant,ivy,junit,logback)
Diffstat (limited to 'java/project/src/test')
-rw-r--r-- | java/project/src/test/java/ch/asynk/Test00.java | 54 | ||||
-rw-r--r-- | java/project/src/test/java/ch/asynk/TestSuite.java | 27 |
2 files changed, 81 insertions, 0 deletions
diff --git a/java/project/src/test/java/ch/asynk/Test00.java b/java/project/src/test/java/ch/asynk/Test00.java new file mode 100644 index 0000000..aae83d7 --- /dev/null +++ b/java/project/src/test/java/ch/asynk/Test00.java @@ -0,0 +1,54 @@ +package ch.asynk; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.BeforeClass; +import org.junit.AfterClass; +import org.junit.rules.ExpectedException; + +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertEquals; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.hasProperty; + +import ch.asynk.MyClass; + +public class Test00 +{ + private static MyClass my; + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @BeforeClass + public static void setUpClass() + { + System.out.println(" BeforeClass : Test00"); + my = new MyClass(); + } + + @AfterClass + public static void tearDownClass() + { + System.out.println(" AfterClass : Test00"); + } + + @Test + public void test_0() + { + assertEquals("n must be equal to 666", my.getN(), 666); + } + + @Test + public void test_1() throws MyException + { + thrown.expect(MyException.class); + thrown.expectMessage("it's mine"); + my.exception(); + } + @Test + public void test_2() throws MyException + { + assertThat(my, hasProperty("n", is(666))); + } +} diff --git a/java/project/src/test/java/ch/asynk/TestSuite.java b/java/project/src/test/java/ch/asynk/TestSuite.java new file mode 100644 index 0000000..3e5d7d8 --- /dev/null +++ b/java/project/src/test/java/ch/asynk/TestSuite.java @@ -0,0 +1,27 @@ +package ch.asynk; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.BeforeClass; +import org.junit.AfterClass; + +@RunWith(Suite.class) + +@Suite.SuiteClasses({ + Test00.class +}) + +public class TestSuite +{ + @BeforeClass + public static void setUpClass() + { + System.out.println("BeforeClass : TestSuite"); + } + + @AfterClass + public static void tearDownClass() + { + System.out.println("AfterClass : TestSuite"); + } +} |