??????Junit????????
???????????? ???????[ 2015/6/2 10:04:04 ] ????????????????
??????????testDivide?????????????????????????????
????a. ?????????п?????????????磺9??3 ??????????3 b. ???????????????????磺10??3 ???????????3 c. ???????????磺10??0 ????????? ????testMultiple???? ???????£?
????@Test(expected=ArithmeticException.class) public void testDivide() { assertEquals(3??Math.divide(9??3)); assertEquals(3??Math.divide(10??3)); Math.divide(10??0); //?????????0?????????
????}
????@Ignore("??????????")
????@Test
????public void testMultiple() {
????}
???????:
????Junit4???????????????ж????????????????????????try/catch?鯰?????????????????????????????“@Test(expected=ArithmeticException.class)”
????Junit4??????????????ArithmeticException???????????????????????????????????@Test????????Щ?????????????糬????????????????????????????????????y????
????@Ignore????????Junit4?????????????????????????????????????????????Щ??????????????????????????????
????3) ???в???
????????
?????????JUnit?????????????????????????????£????????????
?????????assertEquals(3??Math.divide(9??3));???assertEquals(2??Math.divide(9??3));????????£????????????
?????????????????????????????
????4) ???????????
????????????????????????????????????????????????????????????????????????????????????в?????????????????????????????????? Junit4??в??????????????????????????annotation?????????С????????????????????????????????????????????+4Suite
??????????????????????и?????????????????????????????MathTestAnother????????class?????Uitl4Suite?????????£?
????package org.bj.util;
????import org.junit.runner.RunWith; import org.junit.runners.Suite;
????import org.junit.runners.Suite.SuiteClasses; /**
????* @???????May 9?? 2015 * @?????? */
????@RunWith(Suite.class)
????@SuiteClasses({MathTest.class??
????MathTestAnother.class})
????public class Util4Suite {
????}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11