source: trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/LongFormUsageDefectTest.java @ 1171

Last change on this file since 1171 was 1171, checked in by adeicke, 11 years ago

Fixed test cases.

  • Property svn:mime-type set to text/plain
File size: 2.7 KB
Line 
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
15package de.ugoe.cs.autoquest.usability.rules.patterns;
16
17import static de.ugoe.cs.autoquest.usability.testutil.FestConditionUtil.absent;
18import static de.ugoe.cs.autoquest.usability.testutil.FestConditionUtil.present;
19import static org.fest.assertions.api.Assertions.assertThat;
20
21import org.junit.Test;
22
23import com.google.common.base.Optional;
24
25import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
26import de.ugoe.cs.autoquest.usability.result.UsabilityDefect;
27import de.ugoe.cs.autoquest.usability.testutil.GenerateTaskModelUtil;
28
29/**
30 * <p>
31 * TODO comment
32 * </p>
33 *
34 * @author Alexander Deicke
35 */
36public class LongFormUsageDefectTest {
37
38        @Test
39    public void should_be_present() {
40        // Given
41        String spec = "UserSession {" +
42                      "  Sequence sequence1 {" +
43                      "    MouseClick t1 {}" +
44                      "    Iteration iteration1 {" +
45                      "      Sequence sequence3 {" +
46                      "        TextInput t {}" +
47                      "        Scroll p {}" +
48                      "      }" +
49                      "    }" +
50                      "    MouseClick b2 {}" +
51                      "  }" + 
52                      "}";
53        ITaskModel taskModel = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
54        // When
55        Optional<UsabilityDefect> recommendation = new LongFormUsageDefect(taskModel).check();
56        // Then
57        assertThat(recommendation).is(present());
58    }
59   
60    @Test
61    public void should_be_absent() {
62        // Given
63        String spec = "UserSession {" +
64                      "  Sequence sequence1 {" +
65                      "    MouseClick t1 {}" +
66                      "    TextInput t {}" +
67                      "    Scroll p {}" +
68                      "    MouseClick b2 {}" +
69                      "  }" + 
70                      "}";
71        ITaskModel taskModel = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
72        // When
73        Optional<UsabilityDefect> recommendation = new LongFormUsageDefect(taskModel).check();
74        // Then
75        assertThat(recommendation).is(absent());
76    }
77
78}
Note: See TracBrowser for help on using the repository browser.