01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.wicket.util.tester;
18:
19: /**
20: *
21: */
22: public class Result {
23: private static final Result PASS = new Result(false);
24: private final boolean failed;
25: private final String message;
26:
27: private Result(boolean failed) {
28: this .failed = failed;
29: this .message = "";
30: }
31:
32: private Result(boolean failed, String message) {
33: this .failed = failed;
34: this .message = message;
35: }
36:
37: /**
38: * @param message the error message for the user
39: * @return a Result which failed
40: */
41: static Result fail(String message) {
42: return new Result(true, message);
43: }
44:
45: /**
46: * @return a Result which passed
47: */
48: static Result pass() {
49: return PASS;
50: }
51:
52: /**
53: * @return true if the result was failed
54: */
55: public boolean wasFailed() {
56: return failed;
57: }
58:
59: /**
60: * @return the error message for the user
61: */
62: public String getMessage() {
63: return message;
64: }
65: }
|