-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #218 from Ragin-LundF/develop
Release 2.7.0
- Loading branch information
Showing
8 changed files
with
94 additions
and
24 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
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
36 changes: 36 additions & 0 deletions
36
src/main/kotlin/com/ragin/bdd/cucumber/matcher/ScenarioStateNeContextMatcher.kt
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,36 @@ | ||
package com.ragin.bdd.cucumber.matcher | ||
|
||
import com.ragin.bdd.cucumber.core.ScenarioStateContext | ||
import net.javacrumbs.jsonunit.core.ParametrizedMatcher | ||
import org.hamcrest.BaseMatcher | ||
import org.hamcrest.Description | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
class ScenarioStateNeContextMatcher : BaseMatcher<Any>(), ParametrizedMatcher { | ||
private var parameter: String? = null | ||
|
||
override fun matches(actual: Any): Boolean { | ||
val parameterFromContext = ScenarioStateContext.scenarioContextMap[parameter] | ||
val actualAsString = actual.toString() | ||
return actualAsString != parameterFromContext | ||
} | ||
|
||
override fun describeTo(description: Description) { | ||
description.appendText("The actual value is equal to the parameter [$parameter]") | ||
} | ||
|
||
override fun describeMismatch(item: Any, description: Description) { | ||
description | ||
.appendText("BDD Context value was [") | ||
.appendValue(ScenarioStateContext.scenarioContextMap[parameter]) | ||
.appendText("].") | ||
.appendText(" JSON Value was [") | ||
.appendValue(item) | ||
.appendText("].") | ||
} | ||
|
||
override fun setParameter(parameter: String) { | ||
this.parameter = parameter | ||
} | ||
} |
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