File: CheckResult.java

package info (click to toggle)
mauve 20080616-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 26,856 kB
  • ctags: 21,952
  • sloc: java: 234,107; sh: 2,834; xml: 208; makefile: 59
file content (171 lines) | stat: -rw-r--r-- 4,211 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
// Tags: not-a-test
// Copyright (C) 2004 by Object Refinery Limited
// Written by David Gilbert (david.gilbert@object-refinery.com)

// This file is part of Mauve Reporter.

// Mauve Reporter is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.

// Mauve Reporter is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Mauve Reporter; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
package gnu.testlet.runner;

/**
 * Records the details of a check that is performed by Mauve.
 */
public class CheckResult {

    /** The check number. */
    private int number;

    /** The check point string. */
    private String checkPoint;

    /** A flag that indicates whether or not the check passed. */
    private boolean passed;

    /** The expected result (converted to a string). */
    private String expected;

    /** The actual result (converted to a string). */
    private String actual;

    /** The log output for the check. */
    private StringBuffer log;

    /**
     * Creates a new check.
     *
     * @param number  the check number.
     * @param passed  a flag that indicates whether or not the check passed.
     */
    CheckResult(int number, boolean passed) {
        this.number = number;
        this.passed = passed;
    }

    /**
     * Returns the check number.
     *
     * @return The check number.
     */
    public int getNumber() {
        return this.number;
    }

    /**
     * Sets the check number.
     *
     * @param number  the number.
     */
    void setNumber(int number) {
        this.number = number;
    }

    /**
     * Returns a flag that indicates whether or not the check passed.
     *
     * @return A boolean.
     */
    public boolean getPassed() {
        return passed;
    }

    /**
     * Sets the flag that indicates whether or not the check passed.
     *
     * @param passed  the flag.
     */
    void setPassed(boolean passed) {
        this.passed = passed;
    }

    /**
     * Returns the check point string.
     *
     * @return The check point string.
     */
    public String getCheckPoint() {
        return checkPoint;
    }

    /**
     * Sets the check point string.
     *
     * @param checkPoint  the check point string.
     */
    void setCheckPoint(String checkPoint) {
        this.checkPoint = checkPoint;
    }

    /**
     * Returns a string representing the actual value.
     *
     * @return The actual value.
     */
    public String getActual() {
        if(actual == null)
            return "n/a";
        return actual;
    }

    /**
     * Sets the actual value.
     *
     * @param actual  the actual value.
     */
    void setActual(String actual) {
        this.actual = actual;
    }

    /**
     * Returns the expected value.
     *
     * @return The expected value.
     */
    public String getExpected() {
        if(expected == null)
            return "n/a";
        return expected;
    }

    /**
     * Sets the expected value.
     *
     * @param expected  the expected value.
     */
    void setExpected(String expected) {
        this.expected = expected;
    }

    /**
     * Returns the log.
     *
     * @return The log.
     */
    public String getLog() {
        if(log == null)
            return "";
        return log.toString();
    }

    /**
     * Appends the specified message to the log.
     *
     * @param message  the message to append.
     */
    void appendToLog(String message) {
        if(log == null)
            log = new StringBuffer();
        log.append(message);
    }
}