@Test
	    public void shouldGetExceptionWhenAgeLessThan0() {
	        Person person = new Person();
	        catchException(person).setAge(-1);
	        assertThat(caughtException(),instanceOf(IllegalArgumentException.class));
	        assertThat(caughtException().getMessage(), containsString("age is invalid"));
	    }
	  這樣的好處是可以的驗(yàn)證異常是被測(cè)方法拋出來(lái)的,而不是其它方法拋出來(lái)的。
catch-exception庫(kù)還提供了多種API來(lái)進(jìn)行測(cè)試。
先加載fest-assertion庫(kù)。
	        <dependency>
	            <groupId>org.easytesting</groupId>
	            <artifactId>fest-assert-core</artifactId>
	            <version>2.0M10</version>
	        </dependency>
	  然后可以書(shū)寫(xiě)B(tài)DD風(fēng)格的測(cè)試。
	    @Test
	    public void shouldGetExceptionWhenAgeLessThan0() {
	        // given
	        Person person = new Person();
	        // when
	        when(person).setAge(-1);
	        // then
	        then(caughtException())
	                .isInstanceOf(IllegalArgumentException.class)
	                .hasMessage("age is invalid")
	                .hasNoCause();
	    }