[1040] | 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 |
|
---|
[1030] | 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 |
|
---|
[1040] | 26 | /**
|
---|
| 27 | * <p>
|
---|
| 28 | * TODO comment
|
---|
| 29 | * </p>
|
---|
| 30 | *
|
---|
| 31 | * @author Alexander Deicke
|
---|
| 32 | */
|
---|
[1030] | 33 | public class FestConditionUtil {
|
---|
| 34 |
|
---|
| 35 | private FestConditionUtil() {
|
---|
| 36 | // no good idea
|
---|
| 37 | }
|
---|
[1040] | 38 |
|
---|
[1030] | 39 | public static Condition<UsabilityEvaluationReport> noUsabilityGuidlineRecommendations() {
|
---|
| 40 | return new Condition<UsabilityEvaluationReport>() {
|
---|
[1040] | 41 |
|
---|
[1030] | 42 | @Override
|
---|
| 43 | public boolean matches(UsabilityEvaluationReport usabilityEvaluationReport) {
|
---|
| 44 | return usabilityEvaluationReport.evaluationResults().isEmpty();
|
---|
| 45 | }
|
---|
| 46 | };
|
---|
| 47 | }
|
---|
[1040] | 48 |
|
---|
[1030] | 49 | public static Condition<UsabilityEvaluationReport> usabilityGuidlineRecommendations() {
|
---|
| 50 | return new Condition<UsabilityEvaluationReport>() {
|
---|
[1040] | 51 |
|
---|
[1030] | 52 | @Override
|
---|
| 53 | public boolean matches(UsabilityEvaluationReport usabilityEvaluationReport) {
|
---|
| 54 | return !usabilityEvaluationReport.evaluationResults().isEmpty();
|
---|
| 55 | }
|
---|
| 56 | };
|
---|
| 57 | }
|
---|
[1040] | 58 |
|
---|
[1030] | 59 | public static Condition<UsabilityRuleset> noUsabilityRules() {
|
---|
| 60 | return new Condition<UsabilityRuleset>() {
|
---|
| 61 |
|
---|
| 62 | @Override
|
---|
| 63 | public boolean matches(UsabilityRuleset usabilityRuleset) {
|
---|
[1034] | 64 | return usabilityRuleset.evaluationRules().isEmpty();
|
---|
[1030] | 65 | }
|
---|
| 66 |
|
---|
| 67 | };
|
---|
| 68 | }
|
---|
[1040] | 69 |
|
---|
[1030] | 70 | public static Condition<UsabilityRuleset> usabilityRules() {
|
---|
| 71 | return new Condition<UsabilityRuleset>() {
|
---|
| 72 |
|
---|
| 73 | @Override
|
---|
| 74 | public boolean matches(UsabilityRuleset usabilityRuleset) {
|
---|
[1034] | 75 | return !usabilityRuleset.evaluationRules().isEmpty();
|
---|
[1030] | 76 | }
|
---|
| 77 |
|
---|
| 78 | };
|
---|
| 79 | }
|
---|
[1040] | 80 |
|
---|
[1030] | 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 | }
|
---|
[1040] | 88 |
|
---|
[1030] | 89 | };
|
---|
| 90 | }
|
---|
[1040] | 91 |
|
---|
[1030] | 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 | }
|
---|
[1040] | 99 |
|
---|
[1030] | 100 | };
|
---|
| 101 | }
|
---|
[1040] | 102 |
|
---|
[1030] | 103 | public static Condition<Optional<UsabilityDefect>> infoRecommendationSeverityLevel() {
|
---|
| 104 | return new Condition<Optional<UsabilityDefect>>() {
|
---|
| 105 |
|
---|
| 106 | @Override
|
---|
| 107 | public boolean matches(Optional<UsabilityDefect> usabilityGuidlineRecommendation) {
|
---|
[1040] | 108 | return usabilityGuidlineRecommendation.get().getSeverityLevel()
|
---|
| 109 | .equals(UsabilityDefectSeverityLevel.INFO);
|
---|
[1030] | 110 | }
|
---|
| 111 |
|
---|
| 112 | };
|
---|
| 113 | }
|
---|
[1040] | 114 |
|
---|
[1030] | 115 | public static Condition<Optional<UsabilityDefect>> lowRecommendationSeverityLevel() {
|
---|
| 116 | return new Condition<Optional<UsabilityDefect>>() {
|
---|
| 117 |
|
---|
| 118 | @Override
|
---|
| 119 | public boolean matches(Optional<UsabilityDefect> usabilityGuidlineRecommendation) {
|
---|
[1040] | 120 | return usabilityGuidlineRecommendation.get().getSeverityLevel()
|
---|
| 121 | .equals(UsabilityDefectSeverityLevel.LOW);
|
---|
[1030] | 122 | }
|
---|
| 123 |
|
---|
| 124 | };
|
---|
| 125 | }
|
---|
[1040] | 126 |
|
---|
[1030] | 127 | public static Condition<Optional<UsabilityDefect>> mediumRecommendationSeverityLevel() {
|
---|
| 128 | return new Condition<Optional<UsabilityDefect>>() {
|
---|
| 129 |
|
---|
| 130 | @Override
|
---|
| 131 | public boolean matches(Optional<UsabilityDefect> usabilityGuidlineRecommendation) {
|
---|
[1040] | 132 | return usabilityGuidlineRecommendation.get().getSeverityLevel()
|
---|
| 133 | .equals(UsabilityDefectSeverityLevel.MEDIUM);
|
---|
[1030] | 134 | }
|
---|
| 135 |
|
---|
| 136 | };
|
---|
| 137 | }
|
---|
[1040] | 138 |
|
---|
[1030] | 139 | public static Condition<Optional<UsabilityDefect>> highRecommendationSeverityLevel() {
|
---|
| 140 | return new Condition<Optional<UsabilityDefect>>() {
|
---|
| 141 |
|
---|
| 142 | @Override
|
---|
| 143 | public boolean matches(Optional<UsabilityDefect> usabilityGuidlineRecommendation) {
|
---|
[1040] | 144 | return usabilityGuidlineRecommendation.get().getSeverityLevel()
|
---|
| 145 | .equals(UsabilityDefectSeverityLevel.HIGH);
|
---|
[1030] | 146 | }
|
---|
| 147 |
|
---|
| 148 | };
|
---|
| 149 | }
|
---|
[1040] | 150 |
|
---|
[1030] | 151 | }
|
---|