[1151] | 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.rules.patterns;
|
---|
| 16 |
|
---|
| 17 | import static de.ugoe.cs.autoquest.usability.testutil.FestConditionUtil.absent;
|
---|
| 18 | import static de.ugoe.cs.autoquest.usability.testutil.FestConditionUtil.present;
|
---|
| 19 | import static org.fest.assertions.api.Assertions.assertThat;
|
---|
| 20 |
|
---|
| 21 | import org.junit.Test;
|
---|
| 22 |
|
---|
| 23 | import com.google.common.base.Optional;
|
---|
| 24 |
|
---|
[1171] | 25 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
|
---|
[1151] | 26 | import de.ugoe.cs.autoquest.usability.result.UsabilityDefect;
|
---|
[1171] | 27 | import de.ugoe.cs.autoquest.usability.testutil.GenerateTaskModelUtil;
|
---|
[1151] | 28 |
|
---|
| 29 | /**
|
---|
| 30 | * <p>
|
---|
| 31 | * TODO comment
|
---|
| 32 | * </p>
|
---|
| 33 | *
|
---|
| 34 | * @author Alexander Deicke
|
---|
| 35 | */
|
---|
| 36 | public class LongFormUsageDefectTest {
|
---|
| 37 |
|
---|
[1171] | 38 | @Test
|
---|
[1151] | 39 | public void should_be_present() {
|
---|
| 40 | // Given
|
---|
[1171] | 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 | " }" +
|
---|
[1151] | 52 | "}";
|
---|
[1171] | 53 | ITaskModel taskModel = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
|
---|
[1151] | 54 | // When
|
---|
[1171] | 55 | Optional<UsabilityDefect> recommendation = new LongFormUsageDefect(taskModel).check();
|
---|
[1151] | 56 | // Then
|
---|
| 57 | assertThat(recommendation).is(present());
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | @Test
|
---|
| 61 | public void should_be_absent() {
|
---|
| 62 | // Given
|
---|
[1171] | 63 | String spec = "UserSession {" +
|
---|
| 64 | " Sequence sequence1 {" +
|
---|
| 65 | " MouseClick t1 {}" +
|
---|
| 66 | " TextInput t {}" +
|
---|
| 67 | " Scroll p {}" +
|
---|
| 68 | " MouseClick b2 {}" +
|
---|
| 69 | " }" +
|
---|
[1151] | 70 | "}";
|
---|
[1171] | 71 | ITaskModel taskModel = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
|
---|
[1151] | 72 | // When
|
---|
[1171] | 73 | Optional<UsabilityDefect> recommendation = new LongFormUsageDefect(taskModel).check();
|
---|
[1151] | 74 | // Then
|
---|
| 75 | assertThat(recommendation).is(absent());
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 | }
|
---|