[1030] | 1 | package de.ugoe.cs.autoquest.usability.testutil;
|
---|
| 2 |
|
---|
| 3 | import org.fest.assertions.core.Condition;
|
---|
| 4 |
|
---|
| 5 | import com.google.common.base.Optional;
|
---|
| 6 |
|
---|
| 7 | import de.ugoe.cs.autoquest.usability.UsabilityEvaluationReport;
|
---|
| 8 | import de.ugoe.cs.autoquest.usability.evaluation.result.UsabilityDefectSeverityLevel;
|
---|
| 9 | import de.ugoe.cs.autoquest.usability.evaluation.result.UsabilityDefect;
|
---|
| 10 | import de.ugoe.cs.autoquest.usability.evaluation.rule.set.UsabilityRuleset;
|
---|
| 11 |
|
---|
| 12 | public class FestConditionUtil {
|
---|
| 13 |
|
---|
| 14 | private FestConditionUtil() {
|
---|
| 15 | // no good idea
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | public static Condition<UsabilityEvaluationReport> noUsabilityGuidlineRecommendations() {
|
---|
| 19 | return new Condition<UsabilityEvaluationReport>() {
|
---|
| 20 |
|
---|
| 21 | @Override
|
---|
| 22 | public boolean matches(UsabilityEvaluationReport usabilityEvaluationReport) {
|
---|
| 23 | return usabilityEvaluationReport.evaluationResults().isEmpty();
|
---|
| 24 | }
|
---|
| 25 | };
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | public static Condition<UsabilityEvaluationReport> usabilityGuidlineRecommendations() {
|
---|
| 29 | return new Condition<UsabilityEvaluationReport>() {
|
---|
| 30 |
|
---|
| 31 | @Override
|
---|
| 32 | public boolean matches(UsabilityEvaluationReport usabilityEvaluationReport) {
|
---|
| 33 | return !usabilityEvaluationReport.evaluationResults().isEmpty();
|
---|
| 34 | }
|
---|
| 35 | };
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | public static Condition<UsabilityRuleset> noUsabilityRules() {
|
---|
| 39 | return new Condition<UsabilityRuleset>() {
|
---|
| 40 |
|
---|
| 41 | @Override
|
---|
| 42 | public boolean matches(UsabilityRuleset usabilityRuleset) {
|
---|
[1034] | 43 | return usabilityRuleset.evaluationRules().isEmpty();
|
---|
[1030] | 44 | }
|
---|
| 45 |
|
---|
| 46 |
|
---|
| 47 | };
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | public static Condition<UsabilityRuleset> usabilityRules() {
|
---|
| 51 | return new Condition<UsabilityRuleset>() {
|
---|
| 52 |
|
---|
| 53 | @Override
|
---|
| 54 | public boolean matches(UsabilityRuleset usabilityRuleset) {
|
---|
[1034] | 55 | return !usabilityRuleset.evaluationRules().isEmpty();
|
---|
[1030] | 56 | }
|
---|
| 57 |
|
---|
| 58 |
|
---|
| 59 | };
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | public static Condition<Optional<UsabilityDefect>> present() {
|
---|
| 63 | return new Condition<Optional<UsabilityDefect>>() {
|
---|
| 64 |
|
---|
| 65 | @Override
|
---|
| 66 | public boolean matches(Optional<UsabilityDefect> usabilityGuidlineRecommendation) {
|
---|
| 67 | return usabilityGuidlineRecommendation.isPresent();
|
---|
| 68 | }
|
---|
| 69 |
|
---|
| 70 | };
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | public static Condition<Optional<UsabilityDefect>> absent() {
|
---|
| 74 | return new Condition<Optional<UsabilityDefect>>() {
|
---|
| 75 |
|
---|
| 76 | @Override
|
---|
| 77 | public boolean matches(Optional<UsabilityDefect> usabilityGuidlineRecommendation) {
|
---|
| 78 | return !usabilityGuidlineRecommendation.isPresent();
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 | };
|
---|
| 82 | }
|
---|
| 83 |
|
---|
| 84 | public static Condition<Optional<UsabilityDefect>> infoRecommendationSeverityLevel() {
|
---|
| 85 | return new Condition<Optional<UsabilityDefect>>() {
|
---|
| 86 |
|
---|
| 87 | @Override
|
---|
| 88 | public boolean matches(Optional<UsabilityDefect> usabilityGuidlineRecommendation) {
|
---|
| 89 | return usabilityGuidlineRecommendation.get().getSeverityLevel().equals(UsabilityDefectSeverityLevel.INFO);
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 | };
|
---|
| 93 | }
|
---|
| 94 |
|
---|
| 95 | public static Condition<Optional<UsabilityDefect>> lowRecommendationSeverityLevel() {
|
---|
| 96 | return new Condition<Optional<UsabilityDefect>>() {
|
---|
| 97 |
|
---|
| 98 | @Override
|
---|
| 99 | public boolean matches(Optional<UsabilityDefect> usabilityGuidlineRecommendation) {
|
---|
| 100 | return usabilityGuidlineRecommendation.get().getSeverityLevel().equals(UsabilityDefectSeverityLevel.LOW);
|
---|
| 101 | }
|
---|
| 102 |
|
---|
| 103 | };
|
---|
| 104 | }
|
---|
| 105 |
|
---|
| 106 | public static Condition<Optional<UsabilityDefect>> mediumRecommendationSeverityLevel() {
|
---|
| 107 | return new Condition<Optional<UsabilityDefect>>() {
|
---|
| 108 |
|
---|
| 109 | @Override
|
---|
| 110 | public boolean matches(Optional<UsabilityDefect> usabilityGuidlineRecommendation) {
|
---|
| 111 | return usabilityGuidlineRecommendation.get().getSeverityLevel().equals(UsabilityDefectSeverityLevel.MEDIUM);
|
---|
| 112 | }
|
---|
| 113 |
|
---|
| 114 | };
|
---|
| 115 | }
|
---|
| 116 |
|
---|
| 117 | public static Condition<Optional<UsabilityDefect>> highRecommendationSeverityLevel() {
|
---|
| 118 | return new Condition<Optional<UsabilityDefect>>() {
|
---|
| 119 |
|
---|
| 120 | @Override
|
---|
| 121 | public boolean matches(Optional<UsabilityDefect> usabilityGuidlineRecommendation) {
|
---|
| 122 | return usabilityGuidlineRecommendation.get().getSeverityLevel().equals(UsabilityDefectSeverityLevel.HIGH);
|
---|
| 123 | }
|
---|
| 124 |
|
---|
| 125 | };
|
---|
| 126 | }
|
---|
| 127 |
|
---|
| 128 | }
|
---|