source: trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/contains/ContainsEventTest.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.8 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.visitors.contains;
16
17import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT;
18import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SELECTION;
19import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SEQUENCE;
20import static org.fest.assertions.api.Assertions.assertThat;
21
22import org.junit.Test;
23
24import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
25import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePattern;
26import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePatternBuilder;
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 ContainsEventTest {
37
38         @Test
39    public void contains_event_positive() {
40        // Given
41        String spec = "UserSession {" +
42                      "  Sequence seq1 {" +
43                      "    TextInput t1 {}" +
44                      "  }" +
45                      "}";
46        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
47        UsagePattern pattern = new UsagePatternBuilder().concernedNode(SEQUENCE).contains(TEXT_INPUT).build();
48        // When
49        boolean patternContained = pattern.containedIn(taskTree);
50        // Then
51        assertThat(patternContained).isTrue();
52    }
53   
54    @Test
55    public void contains_event_negative() {
56        // Given
57        String spec = "UserSession {" +
58                      "  Iteration it1 {" +
59                      "    Sequence seq1 {" +
60                      "      MouseClick t1 {}" +
61                      "      MouseClick t2 {}" +
62                      "    }" +
63                      "  }" +
64                      "}";
65        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
66        UsagePattern pattern = new UsagePatternBuilder().concernedNode(SELECTION).contains(TEXT_INPUT).build();
67        // When
68        boolean patternContained = pattern.containedIn(taskTree);
69        // Then
70        assertThat(patternContained).isFalse();
71    }
72
73}
Note: See TracBrowser for help on using the repository browser.