This repository has been archived by the owner on Mar 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit test for the SutStateConverter #19
- Loading branch information
Showing
1 changed file
with
69 additions
and
0 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
src/test/scala/de/retest/guistatemachine/api/neo4j/SutStateConverterSpec.scala
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package de.retest.guistatemachine.api.neo4j | ||
|
||
import de.retest.guistatemachine.api.AbstractApiSpec | ||
import org.scalatest.BeforeAndAfterEach | ||
|
||
class SutStateConverterSpec extends AbstractApiSpec with BeforeAndAfterEach { | ||
|
||
"SutStateConverter" should { | ||
"save and load SutState " in { | ||
val cut = new SutStateConverter | ||
val rootElementA = getRootElement("a", 0) | ||
val rootElementB = getRootElement("b", 0) | ||
val rootElementC = getRootElement("c", 0) | ||
val initialSutState = createSutState(rootElementA, rootElementB, rootElementC) | ||
|
||
val result = cut.toGraphProperty(initialSutState) | ||
result shouldEqual | ||
"""<?xml version="1.0" encoding="UTF-8"?> | ||
|<sutState xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
| <descriptors retestId="retestId" screenId="0" screen="screen0" title="My Window"> | ||
| <identifyingAttributes> | ||
| <attributes> | ||
| <attribute key="a" xsi:type="stringAttribute">a</attribute> | ||
| <attribute key="b" xsi:type="stringAttribute">a</attribute> | ||
| <attribute key="c" xsi:type="stringAttribute">a</attribute> | ||
| </attributes> | ||
| </identifyingAttributes> | ||
| <attributes/> | ||
| <screenshot> | ||
| <persistenceId>prefix_039058c6f2c0cb492c533b0a4d14ef77cc0f78abccced5287d84a1a2011cfb81</persistenceId> | ||
| <type>PNG</type> | ||
| </screenshot> | ||
| </descriptors> | ||
| <descriptors retestId="retestId" screenId="0" screen="screen0" title="My Window"> | ||
| <identifyingAttributes> | ||
| <attributes> | ||
| <attribute key="a" xsi:type="stringAttribute">b</attribute> | ||
| <attribute key="b" xsi:type="stringAttribute">b</attribute> | ||
| <attribute key="c" xsi:type="stringAttribute">b</attribute> | ||
| </attributes> | ||
| </identifyingAttributes> | ||
| <attributes/> | ||
| <screenshot> | ||
| <persistenceId>prefix_039058c6f2c0cb492c533b0a4d14ef77cc0f78abccced5287d84a1a2011cfb81</persistenceId> | ||
| <type>PNG</type> | ||
| </screenshot> | ||
| </descriptors> | ||
| <descriptors retestId="retestId" screenId="0" screen="screen0" title="My Window"> | ||
| <identifyingAttributes> | ||
| <attributes> | ||
| <attribute key="a" xsi:type="stringAttribute">c</attribute> | ||
| <attribute key="b" xsi:type="stringAttribute">c</attribute> | ||
| <attribute key="c" xsi:type="stringAttribute">c</attribute> | ||
| </attributes> | ||
| </identifyingAttributes> | ||
| <attributes/> | ||
| <screenshot> | ||
| <persistenceId>prefix_039058c6f2c0cb492c533b0a4d14ef77cc0f78abccced5287d84a1a2011cfb81</persistenceId> | ||
| <type>PNG</type> | ||
| </screenshot> | ||
| </descriptors> | ||
|</sutState> | ||
|""".stripMargin | ||
|
||
val loadedSutState = cut.toEntityAttribute(result) | ||
loadedSutState shouldEqual initialSutState | ||
} | ||
} | ||
} |