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.result.UsabilityDefect;
|
---|
22 | import de.ugoe.cs.autoquest.usability.result.UsabilityDefectSeverityLevel;
|
---|
23 | import de.ugoe.cs.autoquest.usability.rules.UsabilityResult;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * <p>
|
---|
27 | * TODO comment
|
---|
28 | * </p>
|
---|
29 | *
|
---|
30 | * @author Alexander Deicke
|
---|
31 | */
|
---|
32 | public class FestConditionUtil {
|
---|
33 |
|
---|
34 | private FestConditionUtil() {
|
---|
35 | // no good idea
|
---|
36 | }
|
---|
37 |
|
---|
38 | public static Condition<UsabilityResult> noUsabilityGuidlineRecommendations() {
|
---|
39 | return new Condition<UsabilityResult>() {
|
---|
40 |
|
---|
41 | @Override
|
---|
42 | public boolean matches(UsabilityResult usabilityResult) {
|
---|
43 | return !usabilityResult.hasDefects();
|
---|
44 | }
|
---|
45 | };
|
---|
46 | }
|
---|
47 |
|
---|
48 | public static Condition<UsabilityResult> usabilityGuidlineRecommendations() {
|
---|
49 | return new Condition<UsabilityResult>() {
|
---|
50 |
|
---|
51 | @Override
|
---|
52 | public boolean matches(UsabilityResult usabilityResult) {
|
---|
53 | return usabilityResult.hasDefects();
|
---|
54 | }
|
---|
55 | };
|
---|
56 | }
|
---|
57 |
|
---|
58 | public static Condition<Optional<UsabilityDefect>> present() {
|
---|
59 | return new Condition<Optional<UsabilityDefect>>() {
|
---|
60 |
|
---|
61 | @Override
|
---|
62 | public boolean matches(Optional<UsabilityDefect> usabilityGuidlineRecommendation) {
|
---|
63 | return usabilityGuidlineRecommendation.isPresent();
|
---|
64 | }
|
---|
65 |
|
---|
66 | };
|
---|
67 | }
|
---|
68 |
|
---|
69 | public static Condition<Optional<UsabilityDefect>> absent() {
|
---|
70 | return new Condition<Optional<UsabilityDefect>>() {
|
---|
71 |
|
---|
72 | @Override
|
---|
73 | public boolean matches(Optional<UsabilityDefect> usabilityGuidlineRecommendation) {
|
---|
74 | return !usabilityGuidlineRecommendation.isPresent();
|
---|
75 | }
|
---|
76 |
|
---|
77 | };
|
---|
78 | }
|
---|
79 |
|
---|
80 | public static Condition<Optional<UsabilityDefect>> infoRecommendationSeverityLevel() {
|
---|
81 | return new Condition<Optional<UsabilityDefect>>() {
|
---|
82 |
|
---|
83 | @Override
|
---|
84 | public boolean matches(Optional<UsabilityDefect> usabilityGuidlineRecommendation) {
|
---|
85 | return usabilityGuidlineRecommendation.get().getSeverityLevel()
|
---|
86 | .equals(UsabilityDefectSeverityLevel.INFO);
|
---|
87 | }
|
---|
88 |
|
---|
89 | };
|
---|
90 | }
|
---|
91 |
|
---|
92 | public static Condition<Optional<UsabilityDefect>> lowRecommendationSeverityLevel() {
|
---|
93 | return new Condition<Optional<UsabilityDefect>>() {
|
---|
94 |
|
---|
95 | @Override
|
---|
96 | public boolean matches(Optional<UsabilityDefect> usabilityGuidlineRecommendation) {
|
---|
97 | return usabilityGuidlineRecommendation.get().getSeverityLevel()
|
---|
98 | .equals(UsabilityDefectSeverityLevel.LOW);
|
---|
99 | }
|
---|
100 |
|
---|
101 | };
|
---|
102 | }
|
---|
103 |
|
---|
104 | public static Condition<Optional<UsabilityDefect>> mediumRecommendationSeverityLevel() {
|
---|
105 | return new Condition<Optional<UsabilityDefect>>() {
|
---|
106 |
|
---|
107 | @Override
|
---|
108 | public boolean matches(Optional<UsabilityDefect> usabilityGuidlineRecommendation) {
|
---|
109 | return usabilityGuidlineRecommendation.get().getSeverityLevel()
|
---|
110 | .equals(UsabilityDefectSeverityLevel.MEDIUM);
|
---|
111 | }
|
---|
112 |
|
---|
113 | };
|
---|
114 | }
|
---|
115 |
|
---|
116 | public static Condition<Optional<UsabilityDefect>> highRecommendationSeverityLevel() {
|
---|
117 | return new Condition<Optional<UsabilityDefect>>() {
|
---|
118 |
|
---|
119 | @Override
|
---|
120 | public boolean matches(Optional<UsabilityDefect> usabilityGuidlineRecommendation) {
|
---|
121 | return usabilityGuidlineRecommendation.get().getSeverityLevel()
|
---|
122 | .equals(UsabilityDefectSeverityLevel.HIGH);
|
---|
123 | }
|
---|
124 |
|
---|
125 | };
|
---|
126 | }
|
---|
127 |
|
---|
128 | }
|
---|