|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| BaseExceptions00.java | - | 100% | 100% | 100% |
|
||||||||||||||
| 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 316 2006-04-04 11:21:20Z pinheirg $ | |
| 23 | * -------------------------------------------------------------------------- | |
| 24 | */ | |
| 25 | package org.objectweb.easybeans.tests.interceptors.business.base; | |
| 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.ExpectedExceptions; | |
| 31 | import org.testng.annotations.Test; | |
| 32 | ||
| 33 | /** | |
| 34 | * Verifies if the interceptors and exceptions are working well. | |
| 35 | * @author Eduardo Studzinski Estima de Castro | |
| 36 | * @author Gisele Pinheiro Souza | |
| 37 | */ | |
| 38 | public class BaseExceptions00 { | |
| 39 | ||
| 40 | /** | |
| 41 | * Bean used to implement the test. | |
| 42 | */ | |
| 43 | private ItfExceptions clBean; | |
| 44 | ||
| 45 | /** | |
| 46 | * Verifies if the interceptor can throw a customized exception. | |
| 47 | * @throws Exception if there is an enhancer exception. | |
| 48 | */ | |
| 49 | 1 | @Test(groups = {"Exceptions"}) |
| 50 | @ExpectedExceptions({CustomException00.class}) | |
| 51 | public void testException00() throws Exception { | |
| 52 | 1 | clBean.throwsOneException00(); |
| 53 | } | |
| 54 | ||
| 55 | /** | |
| 56 | * Verifies if the interceptor can throw a customized exception. | |
| 57 | * @throws Exception if there is an enhancer exception. | |
| 58 | */ | |
| 59 | 1 | @Test(groups = {"Exceptions"}) |
| 60 | @ExpectedExceptions({CustomException01.class}) | |
| 61 | public void testException01() throws Exception { | |
| 62 | 1 | clBean.throwsOneException01(); |
| 63 | } | |
| 64 | ||
| 65 | /** | |
| 66 | * Verifies if the interceptor can throw a customized exception. | |
| 67 | * @throws Exception if there is an enhancer exception. | |
| 68 | */ | |
| 69 | 1 | @Test(groups = {"Exceptions"}) |
| 70 | @ExpectedExceptions({CustomException01.class}) | |
| 71 | public void testException02() throws Exception { | |
| 72 | 1 | try { |
| 73 | 1 | clBean.throwsOneException00(); |
| 74 | } catch (CustomException00 e) { | |
| 75 | 1 | clBean.throwsOneException01(); |
| 76 | } | |
| 77 | } | |
| 78 | ||
| 79 | /** | |
| 80 | * Verifies if the interceptor can throw a customized exception. | |
| 81 | * @throws Exception if there is an enhancer exception. | |
| 82 | */ | |
| 83 | 1 | @Test(groups = {"Exceptions"}) |
| 84 | @ExpectedExceptions({CustomException00.class}) | |
| 85 | public void testException03() throws Exception { | |
| 86 | 1 | clBean.throwsTwoExceptions(); |
| 87 | } | |
| 88 | ||
| 89 | /** | |
| 90 | * Sets bean used in the tests. | |
| 91 | * @param bean The bean to set. | |
| 92 | */ | |
| 93 | 4 | public void setBean(final ItfExceptions bean){ |
| 94 | 4 | this.clBean = bean; |
| 95 | } | |
| 96 | } |
|
||||||||||