Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored SpecBuilderRightOf and added tests for it
- Loading branch information
Showing
3 changed files
with
45 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...ore/src/test/java/com/galenframework/tests/generator/builders/SpecBuilderRightofTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,37 @@ | |||
package com.galenframework.tests.generator.builders; | |||
|
|||
import com.galenframework.generator.*; | |||
import com.galenframework.generator.builders.SpecBuilderRightOf; | |||
import com.galenframework.generator.builders.SpecGeneratorOptions; | |||
import com.galenframework.generator.raycast.EdgesContainer; | |||
import com.galenframework.page.Point; | |||
import com.galenframework.page.Rect; | |||
import org.testng.annotations.Test; | |||
|
|||
import java.util.LinkedList; | |||
import java.util.List; | |||
|
|||
import static org.hamcrest.MatcherAssert.assertThat; | |||
import static org.hamcrest.Matchers.is; | |||
|
|||
public class SpecBuilderRightofTest { | |||
|
|||
@Test | |||
public void should_generate_spec_rightof() { | |||
SpecBuilderRightOf specBuilderRightOf = new SpecBuilderRightOf( | |||
new PageItem("icon", new Rect(100, 10, 50, 50)), | |||
new EdgesContainer.Edge(new PageItemNode(new PageItem("caption")), new Point(70, 10), new Point(70, 50)) | |||
); | |||
|
|||
List<SpecStatement> specStatements = specBuilderRightOf.buildSpecs(new LinkedList<>(), new SpecGeneratorOptions()); | |||
|
|||
assertThat(specStatements.size(), is(1)); | |||
SpecStatement statement = specStatements.get(0); | |||
assertThat(statement.getStatement(), is("right-of caption 30px")); | |||
|
|||
assertThat(statement.getAssertions().size(), is(1)); | |||
assertThat(statement.getAssertions().get(0), is(new SpecAssertion( | |||
new AssertionEdge("icon", AssertionEdge.EdgeType.left), | |||
new AssertionEdge("caption", AssertionEdge.EdgeType.right)))); | |||
} | |||
} |