[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.
|
---|
[1030] | 14 |
|
---|
| 15 | package de.ugoe.cs.autoquest.usability;
|
---|
| 16 |
|
---|
| 17 | import static de.ugoe.cs.autoquest.usability.testutil.FestConditionUtil.noUsabilityGuidlineRecommendations;
|
---|
| 18 | import static de.ugoe.cs.autoquest.usability.testutil.FestConditionUtil.usabilityGuidlineRecommendations;
|
---|
| 19 | import static org.fest.assertions.api.Assertions.assertThat;
|
---|
| 20 |
|
---|
| 21 | import java.util.Collections;
|
---|
| 22 | import java.util.List;
|
---|
| 23 |
|
---|
| 24 | import org.fest.util.Lists;
|
---|
| 25 | import org.junit.Test;
|
---|
| 26 |
|
---|
| 27 | import de.ugoe.cs.autoquest.usability.evaluation.result.UsabilityDefectSeverityLevel;
|
---|
| 28 | import de.ugoe.cs.autoquest.usability.evaluation.result.UsabilityDefect;
|
---|
| 29 | import de.ugoe.cs.autoquest.usability.evaluation.result.UsabilityDefectFactory;
|
---|
| 30 | import de.ugoe.cs.autoquest.usability.testutil.DummyUsabilityGuidlineDescriptionResolver;
|
---|
| 31 | import de.ugoe.cs.autoquest.usability.testutil.DummyUsabilityRuleset;
|
---|
| 32 |
|
---|
[1040] | 33 | /**
|
---|
| 34 | * <p>
|
---|
| 35 | * TODO comment
|
---|
| 36 | * </p>
|
---|
| 37 | *
|
---|
| 38 | * @author Alexander Deicke
|
---|
| 39 | */
|
---|
[1030] | 40 | public class UsabilityEvaluationReportTest {
|
---|
| 41 |
|
---|
| 42 | @Test(expected = NullPointerException.class)
|
---|
| 43 | public void usability_report_from_null_should_throw_exception() {
|
---|
| 44 | UsabilityEvaluationReport.from(null);
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | @Test
|
---|
| 48 | public void usability_report_from_empty_list_has_no_recommendations() {
|
---|
| 49 | UsabilityEvaluationReport evaluationReport =
|
---|
[1040] | 50 | UsabilityEvaluationReport.from(Collections.<UsabilityDefect> emptyList());
|
---|
[1030] | 51 | assertThat(evaluationReport).isNotNull().has(noUsabilityGuidlineRecommendations());
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | @Test
|
---|
| 55 | public void usability_report_from_non_empty_list_has_recommendations() {
|
---|
| 56 | List<UsabilityDefect> guidlineRecommendations =
|
---|
[1040] | 57 | Lists
|
---|
| 58 | .newArrayList(new UsabilityDefectFactory(
|
---|
| 59 | new DummyUsabilityGuidlineDescriptionResolver())
|
---|
[1030] | 60 | .createUsabilityGuidlineRecommendation(UsabilityDefectSeverityLevel.INFO,
|
---|
| 61 | new DummyUsabilityRuleset()
|
---|
[1040] | 62 | .evaluationRules().iterator().next(),
|
---|
[1030] | 63 | Collections.<String, String> emptyMap()));
|
---|
| 64 | UsabilityEvaluationReport evaluationReport =
|
---|
| 65 | UsabilityEvaluationReport.from(guidlineRecommendations);
|
---|
| 66 | assertThat(evaluationReport).isNotNull().has(usabilityGuidlineRecommendations());
|
---|
| 67 | }
|
---|
| 68 |
|
---|
| 69 | }
|
---|