????λ?????????? >> ??????????
???JUnit??????Java?????е???
???????????? ???????[ 2014/7/10 11:11:57 ] ????????JUnit ??????????
???????JUnit??????Java?????е????к??????????????????
???????????????class??
Person.java
public class Person {
private String name;
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
if (age < 0 ) {
throw new IllegalArgumentException("age is invalid");
}
this.age = age;
}
}
|
??????????????setAge??????
Try-catch ???
@Test
public void shouldGetExceptionWhenAgeLessThan0() {
Person person = new Person();
try {
person.setAge(-1);
fail("should get IllegalArgumentException");
} catch (IllegalArgumentException ex) {
assertThat(ex.getMessage()??containsString("age is invalid"));
}
}
|
????????????????????????????????
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
JUnit????????????Junit???????????Junit???????е??????Android?μ?Junit????Android?????Junit???е??????JUnit??д??????????????С??Junit??????????github?????JUnit???????????????????????JUnit3.8??Spring 4.0 JUnit????Controller??????????Junit????????Myeclipse???JUnit???е??????Maven???Junit???е??????Linux??Junit????????????????????????Junit Test Suite?????????????Jenkins+Ant+Java+Junit+SVN??????SpringMVC????Junit????
???·???
??????????????????
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????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????