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;
|
---|
16 |
|
---|
17 | import static de.ugoe.cs.autoquest.usability.evaluation.rule.set.RulesetFactory.emptyUsabilityRuleset;
|
---|
18 | import static org.fest.assertions.api.Assertions.assertThat;
|
---|
19 |
|
---|
20 | import org.junit.Test;
|
---|
21 |
|
---|
22 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTree;
|
---|
23 | import de.ugoe.cs.autoquest.usability.UsabilityEvaluationFacade.ExecuteUsabilityEvaluationStep;
|
---|
24 | import de.ugoe.cs.autoquest.usability.testutil.DummyUsabilityRuleset;
|
---|
25 | import de.ugoe.cs.autoquest.usability.testutil.TaskTreeBuilder;
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * <p>
|
---|
29 | * TODO comment
|
---|
30 | * </p>
|
---|
31 | *
|
---|
32 | * @author Alexander Deicke
|
---|
33 | */
|
---|
34 | public class UsabilityEvaluationFacadeTest {
|
---|
35 |
|
---|
36 | @Test(expected = NullPointerException.class)
|
---|
37 | public void apply_null_for_ruleset_should_throw_exception() {
|
---|
38 | UsabilityEvaluationFacade.applyUsabilityRuleset(null);
|
---|
39 | }
|
---|
40 |
|
---|
41 | @Test
|
---|
42 | public void apply_empty_ruleset_should_return_execute_usability_evaluation_step() {
|
---|
43 | ExecuteUsabilityEvaluationStep executeUsabilityEvaluationStep =
|
---|
44 | UsabilityEvaluationFacade.applyUsabilityRuleset(emptyUsabilityRuleset());
|
---|
45 | assertThat(executeUsabilityEvaluationStep)
|
---|
46 | .isInstanceOf(ExecuteUsabilityEvaluationStep.class);
|
---|
47 | }
|
---|
48 |
|
---|
49 | @Test(expected = NullPointerException.class)
|
---|
50 | public void evaluate_usability_of_null_should_throw_exception() {
|
---|
51 | UsabilityEvaluationFacade.applyUsabilityRuleset(emptyUsabilityRuleset())
|
---|
52 | .evaluateUsabilityOf(null);
|
---|
53 | }
|
---|
54 |
|
---|
55 | @Test
|
---|
56 | public void evaluate_usability_of_task_tree_against_empty_ruleset_should_return_empty_evaluation_report()
|
---|
57 | {
|
---|
58 | ITaskTree taskTree = TaskTreeBuilder.builder().root("Ich bin eine Wurzel").creatTaskTree();
|
---|
59 | UsabilityEvaluationReport evaluationReport =
|
---|
60 | UsabilityEvaluationFacade.applyUsabilityRuleset(emptyUsabilityRuleset())
|
---|
61 | .evaluateUsabilityOf(taskTree);
|
---|
62 | assertThat(evaluationReport).isNotNull();
|
---|
63 | }
|
---|
64 |
|
---|
65 | @Test
|
---|
66 | public void evaluate_usability_of_task_tree_against_dummy_ruleset_should_return_non_empty_evaluation_report()
|
---|
67 | {
|
---|
68 | ITaskTree taskTree = TaskTreeBuilder.builder().root("Ich bin eine Wurzel").creatTaskTree();
|
---|
69 | UsabilityEvaluationReport evaluationReport =
|
---|
70 | UsabilityEvaluationFacade.applyUsabilityRuleset(new DummyUsabilityRuleset())
|
---|
71 | .evaluateUsabilityOf(taskTree);
|
---|
72 | assertThat(evaluationReport).isNotNull();
|
---|
73 | }
|
---|
74 |
|
---|
75 | }
|
---|