Skip to content

Commit

Permalink
* Fix - Renamed and moved Type to String implicit conversion as they …
Browse files Browse the repository at this point in the history
…are used only in tests.
  • Loading branch information
miroslavpojer committed Nov 1, 2023
1 parent a15a420 commit 5ec5a73
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,4 @@ object AssertResponseActionType extends Enumeration {
private val stringToValueMap = values.map(v => v.toString -> v).toMap

def fromString(s: String): Option[AssertResponseActionType] = stringToValueMap.get(s)

// Implicit conversion from AssertResponseActionType to String
implicit def enumValueToString(value: AssertResponseActionType): String = value.toString
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ object ExtractJsonResponseActionType extends Enumeration {
private val stringToValueMap = values.map(v => v.toString -> v).toMap

def fromString(s: String): Option[ExtractJsonResponseActionType] = stringToValueMap.get(s)

// Implicit conversion from AssertResponseActionType to String
implicit def enumValueToString(value: ExtractJsonResponseActionType): String = value.toString
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,4 @@ object LogResponseActionType extends Enumeration {
private val stringToValueMap = values.map(v => v.toString -> v).toMap

def fromString(s: String): Option[LogResponseActionType] = stringToValueMap.get(s)

// Implicit conversion from AssertResponseActionType to String
implicit def enumValueToString(value: LogResponseActionType): String = value.toString
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ package africa.absa.testing.scapi.rest.response
import africa.absa.testing.scapi.json.ResponseAction
import africa.absa.testing.scapi.rest.model.CookieValue
import africa.absa.testing.scapi.rest.response.action.AssertionResponseAction
import africa.absa.testing.scapi.rest.response.action.types.AssertResponseActionType.AssertResponseActionType
import africa.absa.testing.scapi.rest.response.action.types.{AssertResponseActionType, ResponseActionGroupType}
import africa.absa.testing.scapi.{ContentValidationFailedException, UndefinedResponseActionTypeException}
import munit.FunSuite

import scala.language.implicitConversions

class ResponseAssertionsTest extends FunSuite {

implicit def assertResponseActionType2String(value: AssertResponseActionType): String = value.toString

/*
validateContent
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@ package africa.absa.testing.scapi.rest.response
import africa.absa.testing.scapi.{AssertionException, ContentValidationFailedException, UndefinedResponseActionTypeException}
import africa.absa.testing.scapi.json.ResponseAction
import africa.absa.testing.scapi.rest.response.action.ExtractJsonResponseAction
import africa.absa.testing.scapi.rest.response.action.types.ExtractJsonResponseActionType.ExtractJsonResponseActionType
import africa.absa.testing.scapi.rest.response.action.types.{ExtractJsonResponseActionType, ResponseActionGroupType}
import africa.absa.testing.scapi.utils.cache.RuntimeCache
import munit.FunSuite

import scala.language.implicitConversions
import scala.util.{Failure, Try}

class ResponseExtractTest extends FunSuite {

implicit def extractJsonResponseActionType2String(value: ExtractJsonResponseActionType): String = value.toString

val assertionStringFromList: ResponseAction = ResponseAction(group = ResponseActionGroupType.EXTRACT_JSON, name = ExtractJsonResponseActionType.STRING_FROM_LIST, Map("cacheKey" -> "question_id", "listIndex" -> "1", "jsonKey" -> "id", "cacheLevel" -> "suite"))
val assertionUnsupported: ResponseAction = ResponseAction(group = ResponseActionGroupType.EXTRACT_JSON, name = "Unsupported", Map("cacheKey" -> "key", "listIndex" -> "200", "jsonKey" -> "jsonKey", "cacheLevel" -> "Test"))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,17 @@ package africa.absa.testing.scapi.rest.response

import africa.absa.testing.scapi.json.ResponseAction
import africa.absa.testing.scapi.rest.response.action.LogResponseAction
import africa.absa.testing.scapi.rest.response.action.types.LogResponseActionType.LogResponseActionType
import africa.absa.testing.scapi.rest.response.action.types.{ResponseActionGroupType, LogResponseActionType => LogType}
import munit.FunSuite

import scala.language.implicitConversions


class ResponseLogTest extends FunSuite {

implicit def logResponseActionType2String(value: LogResponseActionType): String = value.toString

/*
validateContent
*/
Expand Down

0 comments on commit 5ec5a73

Please sign in to comment.