01: package com.reeltwo.jumble.fast;
02:
03: /**
04: * Class representing the result of a single mutation test. Possibly should be
05: * moved to package com.reeltwo.jumble.
06: *
07: * @author Tin Pavlinic
08: * @version $Revision$
09: */
10: public class MutationResult {
11: public static final int PASS = 0;
12:
13: public static final int FAIL = 1;
14:
15: public static final int TIMEOUT = 2;
16:
17: private int mStatus;
18:
19: private String mClassName;
20:
21: private int mPoint;
22:
23: // Describes the mutation applied
24: private String mDescription;
25:
26: // Describes the test that detected the mutation
27: private String mTestDescription;
28:
29: public MutationResult(int status, String className, int point,
30: String description, String testDescription) {
31: this (status, className, point, description);
32: mTestDescription = testDescription;
33: }
34:
35: public MutationResult(int status, String className, int point,
36: String description) {
37: if (status != PASS && status != FAIL && status != TIMEOUT) {
38: throw new RuntimeException("Invalid mutation status: "
39: + status);
40: }
41: mClassName = className;
42: mPoint = point;
43: mStatus = status;
44: mDescription = description;
45: }
46:
47: public String getClassName() {
48: return mClassName;
49: }
50:
51: public int getMutationPoint() {
52: return mPoint;
53: }
54:
55: public String getDescription() {
56: return mDescription;
57: }
58:
59: public String getTestDescription() {
60: return mTestDescription;
61: }
62:
63: public boolean isPassed() {
64: return mStatus == PASS;
65: }
66:
67: public boolean isFailed() {
68: return mStatus == FAIL;
69: }
70:
71: public boolean isTimedOut() {
72: return mStatus == TIMEOUT;
73: }
74:
75: public int getStatus() {
76: return mStatus;
77: }
78:
79: public String toString() {
80: return getDescription();
81: }
82:
83: }
|