3.6??JUnit??????

???????м?????????£?

1??д?????????Triangle?????????TestCase??????ExampleTest:

2??ExampleTest??д????????????????????????????(?????test?????????????????????????Щ???????????????????????)

3??ExampleTest??д???suite()????????????÷???????????????????е?testXxxx??????????????

Junit???????????????????????????????6??????????????????????????????????????

test case???????????????????????????????

test suite??????????????????????в?????????Ч?????? ???ж??testcase????????

jdbc fixture????????????????????????????????????????????????????jdbc???????

jndi fixture???????????????????????????????????????????Щ????????fixture??

???????????????Щ?????????????????????????????????棬?????????????????????????????????????????????????????????????????????????????????

comparision fixture????????????????????

custom fixture:?????????????á???????????????

junitx.framework?????????

?e??????????????junit.framework.Assert??????

??????????????ü????????????????????????????????????????????????????????????????????????

junitx.framework.Assert

junitx.framework.ArrayAssert

junitx.framework.ComparableAssert

junitx.framework.FileAssert

junitx.framework.ListAssert

junitx.framework.ObjectAssert

junitx.framework.NamingAssert

junitx.framework.OrderedTestSuite

junitx.framework.StringAssert

junitx.framework.ThrowableAssert

2. ??????????????

2.1 ??????????????????

????????junitx.util.PrivateAccessor?????????????????????????

?ο?:

ExampleJUnit_Addons_Exampleexample1????

example1.TestAccount??

example1.Account??

2.2 ??????????????????????

????Java???????????????

l .???java.lang.Class????????????????????????Field????????

field.setAccessible(true);????????????飬?????????Field????????

?????????Field?????

2.???java.lang.Class????????????????????????Method;??????

field.setAccessible(true);?????????????;????и÷???.

3. junitx.extensions?????????

?????????????????巽??????????????????????

???????巽?????????????????????????????????????????????????????????????????С?

JUnit-addons??????????????:

junitx.extensions.ComparabilityTestCase

junitx.extensions.EqualsHashCodeTestCase

junitx.extensions.SerializabilityTestCase

?????????????????????????Щ?????????????????????????????????????????????Щ????????TestSuite???棬????????????????????????????????????????????????????Щ????????????????????????set?????????????????????????

?ο??????ExampleJUnit_Addons_Exampleexample1srcextensions????extensions.WdzEqualsHashCodeTestCase??

?????????IOC??????????????漸????????????£??????????ù???????????????Щ????????????Щ??????????????????ù???????????????????????????TestRunner???