1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany
|
---|
2 | //
|
---|
3 | // Licensed under the Apache License, Version 2.0 (the "License");
|
---|
4 | // you may not use this file except in compliance with the License.
|
---|
5 | // You may obtain a copy of the License at
|
---|
6 | //
|
---|
7 | // http://www.apache.org/licenses/LICENSE-2.0
|
---|
8 | //
|
---|
9 | // Unless required by applicable law or agreed to in writing, software
|
---|
10 | // distributed under the License is distributed on an "AS IS" BASIS,
|
---|
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
12 | // See the License for the specific language governing permissions and
|
---|
13 | // limitations under the License.
|
---|
14 |
|
---|
15 | package de.ugoe.cs.autoquest.usability.testutil;
|
---|
16 |
|
---|
17 | import org.fest.assertions.core.Condition;
|
---|
18 |
|
---|
19 | import com.google.common.base.Optional;
|
---|
20 |
|
---|
21 | import de.ugoe.cs.autoquest.usability.UsabilityEvaluationReport;
|
---|
22 | import de.ugoe.cs.autoquest.usability.evaluation.result.UsabilityDefectSeverityLevel;
|
---|
23 | import de.ugoe.cs.autoquest.usability.evaluation.result.UsabilityDefect;
|
---|
24 | import de.ugoe.cs.autoquest.usability.evaluation.rule.set.UsabilityRuleset;
|
---|
25 |
|
---|
26 | /**
|
---|
27 | * <p>
|
---|
28 | * TODO comment
|
---|
29 | * </p>
|
---|
30 | *
|
---|
31 | * @author Alexander Deicke
|
---|
32 | */
|
---|
33 | public class FestConditionUtil {
|
---|
34 |
|
---|
35 | private FestConditionUtil() {
|
---|
36 | // no good idea
|
---|
37 | }
|
---|
38 |
|
---|
39 | public static Condition<UsabilityEvaluationReport> noUsabilityGuidlineRecommendations() {
|
---|
40 | return new Condition<UsabilityEvaluationReport>() {
|
---|
41 |
|
---|
42 | @Override
|
---|
43 | public boolean matches(UsabilityEvaluationReport usabilityEvaluationReport) {
|
---|
44 | return usabilityEvaluationReport.evaluationResults().isEmpty();
|
---|
45 | }
|
---|
46 | };
|
---|
47 | }
|
---|
48 |
|
---|
49 | public static Condition<UsabilityEvaluationReport> usabilityGuidlineRecommendations() {
|
---|
50 | return new Condition<UsabilityEvaluationReport>() {
|
---|
51 |
|
---|
52 | @Override
|
---|
53 | public boolean matches(UsabilityEvaluationReport usabilityEvaluationReport) {
|
---|
54 | return !usabilityEvaluationReport.evaluationResults().isEmpty();
|
---|
55 | }
|
---|
56 | };
|
---|
57 | }
|
---|
58 |
|
---|
59 | public static Condition<UsabilityRuleset> noUsabilityRules() {
|
---|
60 | return new Condition<UsabilityRuleset>() {
|
---|
61 |
|
---|
62 | @Override
|
---|
63 | public boolean matches(UsabilityRuleset usabilityRuleset) {
|
---|
64 | return usabilityRuleset.evaluationRules().isEmpty();
|
---|
65 | }
|
---|
66 |
|
---|
67 | };
|
---|
68 | }
|
---|
69 |
|
---|
70 | public static Condition<UsabilityRuleset> usabilityRules() {
|
---|
71 | return new Condition<UsabilityRuleset>() {
|
---|
72 |
|
---|
73 | @Override
|
---|
74 | public boolean matches(UsabilityRuleset usabilityRuleset) {
|
---|
75 | return !usabilityRuleset.evaluationRules().isEmpty();
|
---|
76 | }
|
---|
77 |
|
---|
78 | };
|
---|
79 | }
|
---|
80 |
|
---|
81 | public static Condition<Optional<UsabilityDefect>> present() {
|
---|
82 | return new Condition<Optional<UsabilityDefect>>() {
|
---|
83 |
|
---|
84 | @Override
|
---|
85 | public boolean matches(Optional<UsabilityDefect> usabilityGuidlineRecommendation) {
|
---|
86 | return usabilityGuidlineRecommendation.isPresent();
|
---|
87 | }
|
---|
88 |
|
---|
89 | };
|
---|
90 | }
|
---|
91 |
|
---|
92 | public static Condition<Optional<UsabilityDefect>> absent() {
|
---|
93 | return new Condition<Optional<UsabilityDefect>>() {
|
---|
94 |
|
---|
95 | @Override
|
---|
96 | public boolean matches(Optional<UsabilityDefect> usabilityGuidlineRecommendation) {
|
---|
97 | return !usabilityGuidlineRecommendation.isPresent();
|
---|
98 | }
|
---|
99 |
|
---|
100 | };
|
---|
101 | }
|
---|
102 |
|
---|
103 | public static Condition<Optional<UsabilityDefect>> infoRecommendationSeverityLevel() {
|
---|
104 | return new Condition<Optional<UsabilityDefect>>() {
|
---|
105 |
|
---|
106 | @Override
|
---|
107 | public boolean matches(Optional<UsabilityDefect> usabilityGuidlineRecommendation) {
|
---|
108 | return usabilityGuidlineRecommendation.get().getSeverityLevel()
|
---|
109 | .equals(UsabilityDefectSeverityLevel.INFO);
|
---|
110 | }
|
---|
111 |
|
---|
112 | };
|
---|
113 | }
|
---|
114 |
|
---|
115 | public static Condition<Optional<UsabilityDefect>> lowRecommendationSeverityLevel() {
|
---|
116 | return new Condition<Optional<UsabilityDefect>>() {
|
---|
117 |
|
---|
118 | @Override
|
---|
119 | public boolean matches(Optional<UsabilityDefect> usabilityGuidlineRecommendation) {
|
---|
120 | return usabilityGuidlineRecommendation.get().getSeverityLevel()
|
---|
121 | .equals(UsabilityDefectSeverityLevel.LOW);
|
---|
122 | }
|
---|
123 |
|
---|
124 | };
|
---|
125 | }
|
---|
126 |
|
---|
127 | public static Condition<Optional<UsabilityDefect>> mediumRecommendationSeverityLevel() {
|
---|
128 | return new Condition<Optional<UsabilityDefect>>() {
|
---|
129 |
|
---|
130 | @Override
|
---|
131 | public boolean matches(Optional<UsabilityDefect> usabilityGuidlineRecommendation) {
|
---|
132 | return usabilityGuidlineRecommendation.get().getSeverityLevel()
|
---|
133 | .equals(UsabilityDefectSeverityLevel.MEDIUM);
|
---|
134 | }
|
---|
135 |
|
---|
136 | };
|
---|
137 | }
|
---|
138 |
|
---|
139 | public static Condition<Optional<UsabilityDefect>> highRecommendationSeverityLevel() {
|
---|
140 | return new Condition<Optional<UsabilityDefect>>() {
|
---|
141 |
|
---|
142 | @Override
|
---|
143 | public boolean matches(Optional<UsabilityDefect> usabilityGuidlineRecommendation) {
|
---|
144 | return usabilityGuidlineRecommendation.get().getSeverityLevel()
|
---|
145 | .equals(UsabilityDefectSeverityLevel.HIGH);
|
---|
146 | }
|
---|
147 |
|
---|
148 | };
|
---|
149 | }
|
---|
150 |
|
---|
151 | }
|
---|