001: /* SpringDdBehaviourCallbackHandler.java
002: *
003: * DDSteps - Data Driven JUnit Test Steps
004: * Copyright (C) 2005 Jayway AB
005: * www.ddsteps.org
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License version 2.1 as published by the Free Software Foundation.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, visit
018: * http://www.opensource.org/licenses/lgpl-license.php
019: */
020:
021: package org.ddsteps.spring;
022:
023: import org.apache.commons.lang.builder.EqualsBuilder;
024: import org.apache.commons.lang.builder.HashCodeBuilder;
025: import org.ddsteps.junit.behaviour.DdBehaviourCallbackHandler;
026:
027: /**
028: * Delegates back to the DdSpringTestCase, calling the especially exposed
029: * superSetUp() and superTearDown() which calls the setUp() and tearDown() which
030: * are protected final in the SpringTestCase base class.
031: *
032: * @author adam
033: * @version $Id: SpringDdBehaviourCallbackHandler.java,v 1.2 2006/01/29 21:25:40
034: * adamskogman Exp $
035: */
036: class SpringDdBehaviourCallbackHandler implements
037: DdBehaviourCallbackHandler {
038:
039: /**
040: * The DataDriven Spring TestCase
041: */
042: private final DDStepsSpringTestCase ddTestCase;
043:
044: /**
045: * @param ddTestCase
046: */
047: SpringDdBehaviourCallbackHandler(DDStepsSpringTestCase ddTestCase) {
048: this .ddTestCase = ddTestCase;
049: }
050:
051: /**
052: * @see org.ddsteps.junit.behaviour.DdBehaviourCallbackHandler#setUp()
053: */
054: public void setUp() throws Exception {
055: ddTestCase.super SetUp();
056: }
057:
058: /**
059: * @see org.ddsteps.junit.behaviour.DdBehaviourCallbackHandler#tearDown()
060: */
061: public void tearDown() throws Exception {
062: ddTestCase.super TearDown();
063: }
064:
065: /**
066: * @see org.ddsteps.junit.behaviour.DdTestCaseHooks#setUpAfterData()
067: */
068: public void setUpAfterData() throws Exception {
069: ddTestCase.setUpAfterData();
070: }
071:
072: /**
073: * @see org.ddsteps.junit.behaviour.DdTestCaseHooks#setUpBeforeData()
074: */
075: public void setUpBeforeData() throws Exception {
076: ddTestCase.setUpBeforeData();
077: }
078:
079: /**
080: * @see org.ddsteps.junit.behaviour.DdTestCaseHooks#setUpMethod()
081: */
082: public void setUpMethod() throws Exception {
083: ddTestCase.setUpMethod();
084: }
085:
086: /**
087: * @see org.ddsteps.junit.behaviour.DdTestCaseHooks#tearDownBeforeData()
088: */
089: public void tearDownBeforeData() throws Exception {
090: ddTestCase.tearDownBeforeData();
091:
092: }
093:
094: /**
095: * @see org.ddsteps.junit.behaviour.DdTestCaseHooks#tearDownAfterData()
096: */
097: public void tearDownAfterData() throws Exception {
098: ddTestCase.tearDownAfterData();
099: }
100:
101: /**
102: * @see org.ddsteps.junit.behaviour.DdTestCaseHooks#tearDownMethod()
103: */
104: public void tearDownMethod() throws Exception {
105: ddTestCase.tearDownMethod();
106: }
107:
108: /**
109: * @see java.lang.Object#equals(java.lang.Object)
110: */
111: public boolean equals(Object obj) {
112: if (obj == null || this .getClass() != obj.getClass()) {
113: return false;
114: }
115: if (this == obj) {
116: return true;
117: }
118: SpringDdBehaviourCallbackHandler o = (SpringDdBehaviourCallbackHandler) obj;
119: return new EqualsBuilder().append(ddTestCase, o.ddTestCase)
120: .isEquals();
121: }
122:
123: /**
124: * @see java.lang.Object#hashCode()
125: */
126: public int hashCode() {
127: return new HashCodeBuilder().append(ddTestCase).toHashCode();
128: }
129: }
|