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.
Fix StateImpl.equals, don't mock RootElement in tests but use a real one
- Loading branch information
Showing
6 changed files
with
55 additions
and
41 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
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
27 changes: 20 additions & 7 deletions
27
src/test/scala/de/retest/guistatemachine/api/DescriptorsSpec.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 |
---|---|---|
@@ -1,19 +1,32 @@ | ||
package de.retest.guistatemachine.api | ||
import scala.collection.immutable.HashSet | ||
|
||
class DescriptorsSpec extends AbstractApiSpec { | ||
|
||
val identifyingAttributesA = getIdentifyingAttributes("a") | ||
val identifyingAttributesB = getIdentifyingAttributes("b") | ||
|
||
val rootElementA = getRootElement("a") | ||
val rootElementB = getRootElement("b") | ||
val descriptorsA = Descriptors(Set(rootElementA)) | ||
val descriptorsB = Descriptors(Set(rootElementB)) | ||
|
||
"Descriptor" should { | ||
"make sure that identifying attributes with different IDs are not equal" in { | ||
identifyingAttributesA shouldNot equal(identifyingAttributesB) | ||
identifyingAttributesA.hashCode() shouldNot equal(identifyingAttributesB.hashCode()) | ||
rootElementA shouldNot equal(rootElementB) | ||
rootElementA.hashCode() shouldNot equal(rootElementB.hashCode()) | ||
} | ||
|
||
"not equal" in { | ||
val d0 = Descriptors(HashSet(getRootElement())) | ||
val d1 = Descriptors(HashSet(getRootElement())) | ||
d0.equals(d1) shouldEqual false | ||
descriptorsA.rootElements.size shouldEqual 1 | ||
descriptorsB.rootElements.size shouldEqual 1 | ||
descriptorsA shouldNot equal(descriptorsB) | ||
} | ||
|
||
"equal" in { | ||
val d0 = Descriptors(HashSet(getRootElement())) | ||
val d1 = Descriptors(HashSet(getRootElement())) | ||
d0.equals(d1) shouldEqual true | ||
descriptorsA.equals(descriptorsA) shouldEqual true | ||
descriptorsB.equals(descriptorsB) shouldEqual true | ||
} | ||
} | ||
} |
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