?????????????????????写??????????????????????写??????????
?????????????????写?????????????????????????????胁?????????????
????github???????? https://github.com/luhan420/jiedui/tree/master
????????????????http://www.cnblogs.com/tj1024/p/4490680.html
???????????
??????????????娣�
??????????????Junit4???胁????Eclipse??????Junit4??????
????1) ??????????
???????????DAO??service?????????????写??????????action????struts2.0??????????????貌????
????1. ??????????????????? ???? + Test????junit4????????????????????????
??????????????????????????????????
????2. ?????????src??械?test???????胁??????????????????????????????
??????????????????
????3. ????????????????????????????????
????4. ???????????????????????????????????
????2) ???????????写
????1. ??????????test????????(testXXXX)??JUnit??????????????械?????
?????小???????????????????????????????????????????????????????????
????2. ????????校???????(assertXXX??fail??????????????JUnit???)??????
???????????卸?????????????????????????????????????????????????????????????????????
????3. ??????????????????????????????泄?????????????????????????
?????????????????????????????????????????
????3) ????????????
????????????????????????????????????????????sql?????????????????????????????????????????????????????????????????????
????4) ????????
????????????????Entity model?????????????????????????????Entity???????????????????Entity??????set/get????????????y??械???????
????5) DAO??????
????????DAO???????写????????????DAO?????????????????胁????????????????????写????????????????????锌??????????????????????????????????????????????????????????
????6) Service??????
????Service????????????Service???????????????????????????????
????7) Struts??????????????
????????…
????????Eclipse??JUnit???梅?
???????????????JUnit???梅?????????梅?????????????????
???????????????????????Eclipse??JUnit???梅???
????????????????写??????????????????????写??????????
????1) ????Math??
????/**
????* @???????May  9??2015
????* @??????  */
????public class Math {
????public static int divide(int x??int y) {        return x/y;
????}
????public static int multiple(int x??int y) {        return x*y;
????}
????}
????2) ????????????
??????????????????????????????new->other??
????????main???????????????????????IDE???胁???? setUp()???????????????????????????????????????? tearDown()?????????????????????????????????????
????setUpBeforeClass()????????????????????????????????????????????? tearDownAfterClass()????????????????????????????????????????? constructor()???????????????
??????????????
??????????????????????伞?
?????????????鈥�???
????/**
????* @???????May 9?? 2015
????* @??????  */
????public class MathTest {   @BeforeClass
????public static void setUpBeforeClass() throws Exception {  }
????@AfterClass
????public static void tearDownAfterClass() throws Exception {  }
????@Test
????public void testDivide() {   fail("Not yet implemented");  }
????@Test
????public void testMultiple() {   fail("Not yet implemented");
????}
????}
?????????
????@BeforeClass????????????????????????????????????????危?@AfterClass???????????????????????????????????巍???2??????????????????@Before??@After??????????????????????????????????????????????????????(????????????????????????????@Before??@After?????)
????@Test?????????????????????????????????????????小?