01: /**
02: * EasyBeans
03: * Copyright (C) 2006 Bull S.A.S.
04: * Contact: easybeans@ow2.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * 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: TestExample.java 1970 2007-10-16 11:49:25Z benoitf $
23: * --------------------------------------------------------------------------
24: */package org.ow2.easybeans.tests.examples;
25:
26: import static org.ow2.easybeans.tests.common.helper.EJBHelper.getBeanRemoteInstance;
27: import static org.testng.Assert.assertEquals;
28:
29: import org.ow2.easybeans.tests.common.ejbs.base.ItfExample;
30: import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.SLSBExample;
31: import org.testng.annotations.BeforeMethod;
32: import org.testng.annotations.Test;
33:
34: /**
35: * This is an example of an EasyBeans Test Suite Class.
36: * @reference It is used to specify the document that the tests cover. Example:
37: * JSR 220-PROPOSED FINAL - Stateless - Method Call
38: * @requirement It is used to specify the classes and files needed to run the
39: * tests. Exampe: EasyBeans must be running and the bean
40: * org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.SFSBExample
41: * must be deployed.
42: * @setup It is used to specify the classes needed to run the test(setup methods).
43: * @author Eduardo Studzinski Estima de Castro
44: * @author Gisele Pinheiro Souza
45: */
46: public class TestExample {
47:
48: /**
49: * Constant.
50: */
51: private static final Integer INPUT = new Integer(1);
52:
53: /**
54: * Bean used in tests.
55: */
56: private ItfExample<Integer> bean;
57:
58: /**
59: * Gets a new bean instance used during the tests.
60: * @throws Exception if an error occurs during the setup.
61: */
62: @SuppressWarnings("unchecked")
63: @BeforeMethod
64: public void setup() throws Exception {
65: // Gets a bean instance.
66: bean = getBeanRemoteInstance(SLSBExample.class,
67: ItfExample.class);
68: }
69:
70: /**
71: * Indicates the test description. Example: Tests if the bean can return a
72: * value without modifications.
73: * @input It is used to specify the classes and files needed to run the
74: * test. Example: Integer value.
75: * @output It is used to specify the classes and files needed to run the
76: * test. Example: The same input integer.
77: * @throws Exception if an error occurs during the test.
78: */
79: @Test
80: public void test00() throws Exception {
81: // Output value, it must be the same as the input.
82: Integer output = bean.getValue(INPUT);
83:
84: // Test if input and output are equal.
85: assertEquals(INPUT, output,
86: "The input and output values should be equal.");
87: }
88: }
|