01: /* JUnitMethodBehaviour.java
02: *
03: * DDSteps - Data Driven JUnit Test Steps
04: * Copyright (C) 2005 Jayway AB
05: * www.ddsteps.org
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License version 2.1 as published by the Free Software Foundation.
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, visit
18: * http://www.opensource.org/licenses/lgpl-license.php
19: */
20:
21: package org.ddsteps.junit.behaviour;
22:
23: import junit.framework.TestResult;
24:
25: /**
26: * This behaviour is the same as the usual behaviour of a JUnit TestCase.
27: * <p>
28: * It's stateless, so a singleton may be used.
29: *
30: * @author adam
31: * @version $Id: JUnitMethodBehaviour.java,v 1.1 2006/01/29 21:25:39 adamskogman Exp $
32: */
33: public class JUnitMethodBehaviour implements DdBehaviour {
34:
35: /**
36: * Default constructor.
37: */
38: public JUnitMethodBehaviour() {
39: }
40:
41: /**
42: * @see org.ddsteps.junit.behaviour.DdBehaviour#countTestCases()
43: */
44: public int countTestCases() {
45: return 1;
46: }
47:
48: /**
49: * Always return true, i.e. let the calling TestCase subclass call super.
50: *
51: * @see org.ddsteps.junit.behaviour.DdBehaviour#run(junit.framework.TestResult, org.ddsteps.junit.behaviour.DdBehaviourCallbackHandler)
52: */
53: public boolean run(TestResult result,
54: DdBehaviourCallbackHandler ddTestCase) {
55: return true;
56: }
57:
58: /**
59: * Delegate back to (@link DdBehaviourCallbackHandler#setUpMethod()).
60: *
61: * @see org.ddsteps.junit.behaviour.DdBehaviour#setUp(org.ddsteps.junit.behaviour.DdBehaviourCallbackHandler)
62: */
63: public void setUp(DdBehaviourCallbackHandler ddTestCase)
64: throws Exception {
65: ddTestCase.setUpMethod();
66: }
67:
68: /**
69: * Delegate back to (@link DdBehaviourCallbackHandler#tearDownMethod()).
70: *
71: * @see org.ddsteps.junit.behaviour.DdBehaviour#tearDown(org.ddsteps.junit.behaviour.DdBehaviourCallbackHandler)
72: */
73: public void tearDown(DdBehaviourCallbackHandler ddTestCase)
74: throws Exception {
75: ddTestCase.tearDownMethod();
76: }
77:
78: }
|