01: /* DDSteps - Data Driven JUnit Test Steps
02: * Copyright (C) 2006 Jayway AB
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License version 2.1 as published by the Free Software Foundation.
07: *
08: * This library is distributed in the hope that it will be useful,
09: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11: * Lesser General Public License for more details.
12: *
13: * You should have received a copy of the GNU Lesser General Public
14: * License along with this library; if not, visit
15: * http://www.opensource.org/licenses/lgpl-license.php
16: */
17: package org.ddsteps.data.support;
18:
19: import junit.framework.TestCase;
20:
21: import org.apache.commons.lang.Validate;
22: import org.ddsteps.data.DataLoader;
23: import org.ddsteps.dataset.DataRow;
24: import org.ddsteps.dataset.DataTable;
25:
26: /**
27: * Useful base class for building proxy data loaders, i.e. DataLoaders that have
28: * no guts, but are only a name for a composite of other data loaders and data
29: * set loaders.
30: *
31: * We're only at version 1.1 and already carrying around baggage... I mean
32: * devoted to backward compatibility :-)
33: *
34: * @author adamskogman
35: *
36: */
37: public abstract class DataLoaderProxySupport implements DataLoader {
38:
39: /**
40: * The real instance.
41: */
42: protected final DataLoader dataLoader;
43:
44: /**
45: * DI constructor.
46: *
47: * @param dataLoader
48: * Not null
49: */
50: protected DataLoaderProxySupport(DataLoader dataLoader) {
51: super ();
52: Validate.notNull(dataLoader,
53: "Argument dataLoader must not be null.");
54: this .dataLoader = dataLoader;
55: }
56:
57: /**
58: * @see org.ddsteps.data.DataLoader#loadRow(junit.framework.TestCase,
59: * java.lang.String, java.lang.String)
60: */
61: public DataRow loadRow(TestCase testCase, String methodName,
62: String rowId) {
63: return dataLoader.loadRow(testCase, methodName, rowId);
64: }
65:
66: /**
67: * @see org.ddsteps.data.DataLoader#loadTable(junit.framework.TestCase,
68: * java.lang.String)
69: */
70: public DataTable loadTable(TestCase testCase, String methodName) {
71: return dataLoader.loadTable(testCase, methodName);
72: }
73:
74: /**
75: * @return Returns the backing dataLoader.
76: */
77: public DataLoader getDataLoader() {
78: return dataLoader;
79: }
80:
81: }
|