KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > interceptors > business > base > exception > BaseExceptions00


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: BaseExceptions00.java 914 2006-07-25 07:33:00Z pinheirg $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.interceptors.business.base.exception;
26
27 import org.objectweb.easybeans.tests.common.ejbs.base.ItfExceptions;
28 import org.objectweb.easybeans.tests.common.exception.CustomException00;
29 import org.objectweb.easybeans.tests.common.exception.CustomException01;
30 import org.testng.annotations.Test;
31
32 /**
33  * Verifies if the interceptors and exceptions are working well.
34  * @author Eduardo Studzinski Estima de Castro
35  * @author Gisele Pinheiro Souza
36  */

37 public class BaseExceptions00 {
38
39     /**
40      * Bean used to implement the test.
41      */

42     private ItfExceptions clBean;
43
44     /**
45      * Verifies if the interceptor can throw a customized exception.
46      * @throws Exception if there is an enhancer exception.
47      */

48     @Test(groups = {"Exceptions"}, expectedExceptions = CustomException00.class)
49     public void testException00() throws Exception JavaDoc {
50         clBean.throwsOneException00();
51     }
52
53     /**
54      * Verifies if the interceptor can throw a customized exception.
55      * @throws Exception if there is an enhancer exception.
56      */

57     @Test(groups = {"Exceptions"}, expectedExceptions = CustomException01.class)
58     public void testException01() throws Exception JavaDoc {
59         clBean.throwsOneException01();
60     }
61
62     /**
63      * Verifies if the interceptor can throw a customized exception.
64      * @throws Exception if there is an enhancer exception.
65      */

66     @Test(groups = {"Exceptions"}, expectedExceptions = CustomException01.class)
67     public void testException02() throws Exception JavaDoc {
68         try {
69             clBean.throwsOneException00();
70         } catch (CustomException00 e) {
71             clBean.throwsOneException01();
72         }
73     }
74
75     /**
76      * Verifies if the interceptor can throw a customized exception.
77      * @throws Exception if there is an enhancer exception.
78      */

79     @Test(groups = {"Exceptions"}, expectedExceptions = CustomException00.class)
80     public void testException03() throws Exception JavaDoc {
81         clBean.throwsTwoExceptions();
82     }
83
84     /**
85      * Sets bean used in the tests.
86      * @param bean The bean to set.
87      */

88     public void setBean(final ItfExceptions bean){
89         this.clBean = bean;
90     }
91 }
92
Popular Tags