sttp.client4.testing

Members list

Type members

Classlikes

abstract class AbstractBackendStub[F[_], P](_monad: MonadError[F], matchers: PartialFunction[GenericRequest[_, _], F[Response[_]]], fallback: Option[GenericBackend[F, P]]) extends GenericBackend[F, P]

Attributes

Companion
object
Supertypes
trait GenericBackend[F, P]
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
abstract class AbstractRecordingBackend[F[_], P](delegate: GenericBackend[F, P]) extends DelegateBackend[F, P], RecordingBackend

Attributes

Supertypes
class DelegateBackend[F, P]
trait GenericBackend[F, P]
class Object
trait Matchable
class Any
Show all
final class AtomicCyclicIterator[+T]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
class BackendStub[F[_]](monad: MonadError[F], matchers: PartialFunction[GenericRequest[_, _], F[Response[_]]], fallback: Option[Backend[F]]) extends AbstractBackendStub[F, Any], Backend[F]

A stub backend to use in tests.

A stub backend to use in tests.

The stub can be configured to respond with a given response if the request matches a predicate (see the whenRequestMatches method).

Note however, that this is not type-safe with respect to the type of the response body - the stub doesn't have a way to check if the type of the body in the configured response is the same as the one specified by the request. Some conversions will be attempted (e.g. from a String to a custom mapped type, as specified in the request, see the documentation for more details).

Predicates can match requests basing on the URI or headers. A ClassCastException might occur if for a given request, a response is specified with the incorrect or inconvertible body type.

Attributes

Companion
object
Supertypes
trait Backend[F]
class AbstractBackendStub[F, Any]
trait GenericBackend[F, Any]
class Object
trait Matchable
class Any
Show all
object BackendStub

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final case class RawStream[T](s: T)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
object ResponseStub

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
implicit class RichTestingRequest[T, R](r: GenericRequest[T, R])

Attributes

Supertypes
class Object
trait Matchable
class Any
class StreamBackendStub[F[_], S](monad: MonadError[F], matchers: PartialFunction[GenericRequest[_, _], F[Response[_]]], fallback: Option[StreamBackend[F, S]]) extends AbstractBackendStub[F, S], StreamBackend[F, S]

A stub backend to use in tests.

A stub backend to use in tests.

The stub can be configured to respond with a given response if the request matches a predicate (see the whenRequestMatches method).

Note however, that this is not type-safe with respect to the type of the response body - the stub doesn't have a way to check if the type of the body in the configured response is the same as the one specified by the request. Some conversions will be attempted (e.g. from a String to a custom mapped type, as specified in the request, see the documentation for more details).

For requests which return the response as a stream, if the stub should return a raw stream value (which should then be passed to the stream-consuming function, or mapped to another value), it should be wrapped with RawStream.

Predicates can match requests basing on the URI or headers. A ClassCastException might occur if for a given request, a response is specified with the incorrect or inconvertible body type.

Attributes

Companion
object
Supertypes
trait StreamBackend[F, S]
trait Backend[F]
class AbstractBackendStub[F, S]
trait GenericBackend[F, S]
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
class SyncBackendStub(matchers: PartialFunction[GenericRequest[_, _], Response[_]], fallback: Option[SyncBackend]) extends AbstractBackendStub[Identity, Any], SyncBackend

A stub backend to use in tests.

A stub backend to use in tests.

The stub can be configured to respond with a given response if the request matches a predicate (see the whenRequestMatches method).

Note however, that this is not type-safe with respect to the type of the response body - the stub doesn't have a way to check if the type of the body in the configured response is the same as the one specified by the request. Some conversions will be attempted (e.g. from a String to a custom mapped type, as specified in the request, see the documentation for more details).

Predicates can match requests basing on the URI or headers. A ClassCastException might occur if for a given request, a response is specified with the incorrect or inconvertible body type.

Attributes

Companion
object
Supertypes
trait SyncBackend
trait Backend[Identity]
trait GenericBackend[Identity, Any]
class Object
trait Matchable
class Any
Show all
Known subtypes

A stub of a synchronous backend.

A stub of a synchronous backend.

Attributes

Companion
class
Supertypes
trait SyncBackend
trait Backend[Identity]
trait GenericBackend[Identity, Any]
class Object
trait Matchable
class Any
Show all
Self type
class WebSocketBackendStub[F[_]](monad: MonadError[F], matchers: PartialFunction[GenericRequest[_, _], F[Response[_]]], fallback: Option[WebSocketBackend[F]]) extends AbstractBackendStub[F, WebSockets], WebSocketBackend[F]

A stub backend to use in tests.

A stub backend to use in tests.

The stub can be configured to respond with a given response if the request matches a predicate (see the whenRequestMatches method).

Note however, that this is not type-safe with respect to the type of the response body - the stub doesn't have a way to check if the type of the body in the configured response is the same as the one specified by the request. Some conversions will be attempted (e.g. from a String to a custom mapped type, as specified in the request, see the documentation for more details).

For web socket requests, the stub can be configured to returned both custom sttp.ws.WebSocket implementations, as well as sttp.ws.testing.WebSocketStub instances.

Predicates can match requests basing on the URI or headers. A ClassCastException might occur if for a given request, a response is specified with the incorrect or inconvertible body type.

Attributes

Companion
object
Supertypes
trait WebSocketBackend[F]
trait Backend[F]
class AbstractBackendStub[F, WebSockets]
trait GenericBackend[F, WebSockets]
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
class WebSocketStreamBackendStub[F[_], S](monad: MonadError[F], matchers: PartialFunction[GenericRequest[_, _], F[Response[_]]], fallback: Option[WebSocketStreamBackend[F, S]]) extends AbstractBackendStub[F, S & WebSockets], WebSocketStreamBackend[F, S]

A stub backend to use in tests.

A stub backend to use in tests.

The stub can be configured to respond with a given response if the request matches a predicate (see the whenRequestMatches method).

Note however, that this is not type-safe with respect to the type of the response body - the stub doesn't have a way to check if the type of the body in the configured response is the same as the one specified by the request. Some conversions will be attempted (e.g. from a String to a custom mapped type, as specified in the request, see the documentation for more details).

For web socket requests, the stub can be configured to returned both custom sttp.ws.WebSocket implementations, as well as sttp.ws.testing.WebSocketStub instances.

For requests which return the response as a stream, if the stub should return a raw stream value (which should then be passed to the stream-consuming function, or mapped to another value), it should be wrapped with RawStream.

Predicates can match requests basing on the URI or headers. A ClassCastException might occur if for a given request, a response is specified with the incorrect or inconvertible body type.

Attributes

Companion
object
Supertypes
trait StreamBackend[F, S]
trait WebSocketBackend[F]
trait Backend[F]
class AbstractBackendStub[F, S & WebSockets]
trait GenericBackend[F, S & WebSockets]
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
class WebSocketSyncBackendStub(matchers: PartialFunction[GenericRequest[_, _], Response[_]], fallback: Option[WebSocketSyncBackend]) extends AbstractBackendStub[Identity, WebSockets], WebSocketSyncBackend

A stub backend to use in tests.

A stub backend to use in tests.

The stub can be configured to respond with a given response if the request matches a predicate (see the whenRequestMatches method).

Note however, that this is not type-safe with respect to the type of the response body - the stub doesn't have a way to check if the type of the body in the configured response is the same as the one specified by the request. Some conversions will be attempted (e.g. from a String to a custom mapped type, as specified in the request, see the documentation for more details).

For web socket requests, the stub can be configured to returned both custom sttp.ws.WebSocket implementations, as well as sttp.ws.testing.WebSocketStub instances.

Predicates can match requests basing on the URI or headers. A ClassCastException might occur if for a given request, a response is specified with the incorrect or inconvertible body type.

Attributes

Companion
object
Supertypes
trait SyncBackend
trait Backend[Identity]
class AbstractBackendStub[Identity, WebSockets]
trait GenericBackend[Identity, WebSockets]
class Object
trait Matchable
class Any
Show all
Known subtypes

A stub of a synchronous backend.

A stub of a synchronous backend.

Attributes

Companion
class
Supertypes
trait SyncBackend
trait Backend[Identity]
class AbstractBackendStub[Identity, WebSockets]
trait GenericBackend[Identity, WebSockets]
class Object
trait Matchable
class Any
Show all
Self type

Implicits

Implicits

final implicit def RichTestingRequest[T, R](r: GenericRequest[T, R]): RichTestingRequest[T, R]