[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 |
|
---|
| 25 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTree;
|
---|
| 26 | import de.ugoe.cs.autoquest.usability.result.UsabilityDefect;
|
---|
| 27 | import de.ugoe.cs.autoquest.usability.testutil.GenerateTaskTreeUtil;
|
---|
| 28 |
|
---|
| 29 | /**
|
---|
| 30 | * <p>
|
---|
| 31 | * TODO comment
|
---|
| 32 | * </p>
|
---|
| 33 | *
|
---|
| 34 | * @author Alexander Deicke
|
---|
| 35 | */
|
---|
| 36 | public class LongFormUsageDefectTest {
|
---|
| 37 |
|
---|
| 38 | @Test
|
---|
| 39 | public void should_be_present() {
|
---|
| 40 | // Given
|
---|
| 41 | String spec = "Sequence {" +
|
---|
| 42 | " Selection {" +
|
---|
| 43 | " MouseClick() {}" +
|
---|
| 44 | " Sequence() {" +
|
---|
| 45 | " MouseClick() {}" +
|
---|
| 46 | " Iteration {" +
|
---|
| 47 | " Sequence {" +
|
---|
| 48 | " TextInput() {}" +
|
---|
| 49 | " Scroll () {}" +
|
---|
| 50 | " }" +
|
---|
| 51 | " }" +
|
---|
| 52 | " MouseClick() {}" +
|
---|
| 53 | " }" +
|
---|
| 54 | " }" +
|
---|
| 55 | "}";
|
---|
| 56 | ITaskTree taskTree = GenerateTaskTreeUtil.getTaskTreeFromSpec(spec);
|
---|
| 57 | // When
|
---|
| 58 | Optional<UsabilityDefect> recommendation = new LongFormUsageDefect(taskTree).check();
|
---|
| 59 | // Then
|
---|
| 60 | assertThat(recommendation).is(present());
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | @Test
|
---|
| 64 | public void should_be_absent() {
|
---|
| 65 | // Given
|
---|
| 66 | String spec = "Sequence {" +
|
---|
| 67 | " Selection {" +
|
---|
| 68 | " MouseClick() {}" +
|
---|
| 69 | " Sequence() {" +
|
---|
| 70 | " MouseClick() {}" +
|
---|
| 71 | " TextInput() {}" +
|
---|
| 72 | " Iteration {" +
|
---|
| 73 | " Scroll () {}" +
|
---|
| 74 | " }" +
|
---|
| 75 | " MouseClick() {}" +
|
---|
| 76 | " }" +
|
---|
| 77 | " }" +
|
---|
| 78 | "}";
|
---|
| 79 | ITaskTree taskTree = GenerateTaskTreeUtil.getTaskTreeFromSpec(spec);
|
---|
| 80 | // When
|
---|
| 81 | Optional<UsabilityDefect> recommendation = new LongFormUsageDefect(taskTree).check();
|
---|
| 82 | // Then
|
---|
| 83 | assertThat(recommendation).is(absent());
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 | }
|
---|