Skip to content

Commit

Permalink
Code hygiene and cleanup
Browse files Browse the repository at this point in the history
* replaced string concat with string template
* moved variable declaration into when
  • Loading branch information
nashjain committed Oct 17, 2024
1 parent a059551 commit b59f5eb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/src/main/kotlin/io/specmatic/core/Dictionary.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Dictionary(private val map: Map<String, Value> = emptyMap()) {
val newMap = value.jsonObject.mapValues { (key, value) ->

val updatedPaths = paths.map { path ->
path + ".$key"
"$path.$key"
}.ifEmpty { listOf(key) }

val pathFoundInDictionary = updatedPaths.firstOrNull { it in map }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ data class HttpResponsePattern(
}

fun matches(response: HttpResponse, resolver: Resolver): Result {
val result = matchesResponse(response, resolver)

return when(result) {
return when(val result = matchesResponse(response, resolver)) {
is Result.Failure -> result.breadCrumb("RESPONSE")
else -> result
}
Expand Down

0 comments on commit b59f5eb

Please sign in to comment.