1 /*
2 *
3 * The DbUnit Database Testing Framework
4 * Copyright (C)2002-2008, DbUnit.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 (at your option) 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 USA
19 *
20 */
21 package org.dbunit.assertion;
22
23 import org.dbunit.dataset.ITable;
24
25 /**
26 * Value object to hold the difference of a single data cell
27 * found while comparing data.
28 * <p>
29 * Inspired by the XMLUnit framework.
30 * </p>
31 *
32 * @author gommma (gommma AT users.sourceforge.net)
33 * @author Last changed by: $Author: gommma $
34 * @version $Revision: 872 $ $Date: 2008-11-08 16:45:52 +0100 (sab, 08 nov 2008) $
35 * @since 2.4.0
36 */
37 public class Difference
38 {
39 private ITable expectedTable;
40 private ITable actualTable;
41 private int rowIndex;
42 private String columnName;
43 private Object expectedValue;
44 private Object actualValue;
45
46 public Difference(ITable expectedTable, ITable actualTable,
47 int rowIndex, String columnName,
48 Object expectedValue, Object actualValue)
49 {
50 super();
51 this.expectedTable = expectedTable;
52 this.actualTable = actualTable;
53 this.rowIndex = rowIndex;
54 this.columnName = columnName;
55 this.expectedValue = expectedValue;
56 this.actualValue = actualValue;
57 }
58
59 public ITable getExpectedTable() {
60 return expectedTable;
61 }
62
63
64 public ITable getActualTable() {
65 return actualTable;
66 }
67
68
69 public int getRowIndex() {
70 return rowIndex;
71 }
72
73 public String getColumnName() {
74 return columnName;
75 }
76
77 public Object getExpectedValue() {
78 return expectedValue;
79 }
80
81 public Object getActualValue() {
82 return actualValue;
83 }
84
85 public String toString()
86 {
87 StringBuffer sb = new StringBuffer();
88 sb.append(getClass().getName()).append("[");
89 sb.append("expectedTable=").append(expectedTable);
90 sb.append(", actualTable=").append(actualTable);
91 sb.append(", rowIndex=").append(rowIndex);
92 sb.append(", columnName=").append(columnName);
93 sb.append(", expectedValue=").append(expectedValue);
94 sb.append(", actualValue=").append(actualValue);
95 sb.append("]");
96 return sb.toString();
97 }
98 }