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