org.scalactic.source Scala Examples

The following examples show how to use org.scalactic.source. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.
Example 1
Source File: EitherValues.scala    From nexus   with Apache License 2.0 5 votes vote down vote up
package ch.epfl.bluebrain.nexus.storage.utils

import org.scalactic.source
import org.scalatest.exceptions.{StackDepthException, TestFailedException}

trait EitherValues {

  class EitherValuable[L, R](either: Either[L, R], pos: source.Position) {
    def rightValue: R =
      either match {
        case Right(value) => value
        case Left(_)      =>
          throw new TestFailedException(
            (_: StackDepthException) => Some("The Either value is not a Right(_)"),
            None,
            pos
          )
      }

    def leftValue: L =
      either match {
        case Left(value) => value
        case Right(_)    =>
          throw new TestFailedException(
            (_: StackDepthException) => Some("The Either value is not a Left(_)"),
            None,
            pos
          )
      }
  }

  implicit def convertEitherToValuable[L, R](either: Either[L, R])(implicit p: source.Position): EitherValuable[L, R] =
    new EitherValuable(either, p)

}

object EitherValues extends EitherValues 
Example 2
Source File: EitherValues.scala    From lithium   with Apache License 2.0 5 votes vote down vote up
package akka.cluster.swissborg

import org.scalactic.source
import org.scalatest.exceptions.{StackDepthException, TestFailedException}

trait EitherValues {

  implicit def convertEitherToValuable[L, R](either: Either[L, R])(implicit p: source.Position): EitherValuable[L, R] =
    new EitherValuable(either, p)

  class EitherValuable[L, R](either: Either[L, R], pos: source.Position) {
    def rightValue: R = either match {
      case Right(value) => value
      case Left(_) =>
        throw new TestFailedException((_: StackDepthException) => Some("The Either value is not a Right(_)"), None, pos)
    }

    def leftValue: L = either match {
      case Left(value) => value
      case Right(_) =>
        throw new TestFailedException((_: StackDepthException) => Some("The Either value is not a Left(_)"), None, pos)
    }
  }
}

object EitherValues extends EitherValues 
Example 3
Source File: BaseTestsSuite.scala    From cats-effect   with Apache License 2.0 5 votes vote down vote up
package cats.effect

import cats.effect.internals.TestUtils
import cats.effect.laws.util.{TestContext, TestInstances}
import org.scalactic.source
import org.scalatest.Tag
import org.scalatest.matchers.should.Matchers
import org.scalatest.funsuite.AnyFunSuite
import org.scalatestplus.scalacheck.Checkers
import org.typelevel.discipline.Laws
import org.typelevel.discipline.scalatest.FunSuiteDiscipline

class BaseTestsSuite
    extends AnyFunSuite
    with Matchers
    with Checkers
    with FunSuiteDiscipline
    with TestInstances
    with TestUtils {

  
  def testAsync[A](name: String, tags: Tag*)(f: TestContext => Unit)(implicit pos: source.Position): Unit =
    // Overriding System.err
    test(name, tags: _*)(silenceSystemErr(f(TestContext())))(pos)

  def checkAllAsync(name: String, f: TestContext => Laws#RuleSet): Unit = {
    val context = TestContext()
    val ruleSet = f(context)

    for ((id, prop) <- ruleSet.all.properties)
      test(name + "." + id) {
        silenceSystemErr(check(prop))
      }
  }
} 
Example 4
Source File: ValueJsonConversionTest.scala    From ingraph   with Eclipse Public License 1.0 5 votes vote down vote up
package ingraph.compiler.sql.driver

import ingraph.compiler.sql.driver.ValueJsonConversion._
import ingraph.compiler.sql.driver.ValueJsonConversionTest._
import org.neo4j.driver.internal.value._
import org.neo4j.driver.internal.{InternalNode, InternalPath, InternalRelationship}
import org.neo4j.driver.v1.Value
import org.scalactic.source
import org.scalactic.source.Position
import org.scalatest.FunSuite

import scala.collection.JavaConverters._
import scala.collection.mutable.ArrayBuffer

class ValueJsonConversionTest extends FunSuite {
  testParameters.foreach { case (value, testName, pos) =>
    test(testName) {
      println(value)

      val jsonString = gson.toJson(value, classOf[Value])
      println(jsonString)

      val deserialized = gson.fromJson(jsonString, classOf[Value])

      assert(value == deserialized)
    }(pos)
  }
}

object ValueJsonConversionTest {
  val testValues: ArrayBuffer[Value] = ArrayBuffer.empty
  val testParameters: ArrayBuffer[(Value, String, Position)] = ArrayBuffer.empty

  def addTest(value: Value, testName: String = null)(implicit pos: source.Position): Unit = {
    testValues += value
    testParameters += ((value, Option(testName).getOrElse(value.getClass.getSimpleName), pos))
  }

  private val stringValue = new StringValue("John")
  private val integerValue = new IntegerValue(101)
  private val propertiesMap = Map[String, Value]("name" -> stringValue).asJava

  addTest(new MapValue(propertiesMap))
  addTest(new BytesValue(Array[Byte](0, 42, 127, -128)))
  addTest(new ListValue(stringValue, integerValue))
  addTest(new NodeValue(new InternalNode(5, List("Label1", "Label2").asJavaCollection, propertiesMap)))
  addTest(new RelationshipValue(new InternalRelationship(42, 10, 20, "Edge_Type_1", propertiesMap)))
  addTest(new PathValue(new InternalPath(
    new InternalNode(0),
    new InternalRelationship(101, 0, 1, "TYPE_A"),
    new InternalNode(1)
  )))
  addTest(BooleanValue.FALSE)
  addTest(BooleanValue.TRUE)
  addTest(NullValue.NULL)
  addTest(stringValue)
  addTest(integerValue)
  addTest(new FloatValue(3.14))
} 
Example 5
Source File: EffectCheckerAsserting.scala    From cats-effect-testing   with Apache License 2.0 5 votes vote down vote up
package cats.effect.testing.scalatest.scalacheck

import cats.effect.Effect
import org.scalactic.source
import org.scalatest.exceptions._
import org.scalatestplus.scalacheck.CheckerAsserting

class EffectCheckerAsserting[F[_], A](implicit F: Effect[F])
    extends CheckerAsserting.CheckerAssertingImpl[F[A]] {

  override type Result = F[Unit]

  override def succeed(result: F[A]): (Boolean, Option[Throwable]) =
    F.toIO(result)
      .attempt
      .unsafeRunSync()
      .fold(e => (false, Some(e)), _ => (true, None))

  override def indicateSuccess(message: => String): Result = F.unit

  override def indicateFailure(
      messageFun: StackDepthException => String,
      undecoratedMessage: => String,
      scalaCheckArgs: List[Any],
      scalaCheckLabels: List[String],
      optionalCause: Option[Throwable],
      pos: source.Position
  ): Result = {
    val error = new GeneratorDrivenPropertyCheckFailedException(
      messageFun,
      optionalCause,
      pos,
      None,
      undecoratedMessage,
      scalaCheckArgs,
      None,
      scalaCheckLabels
    )

    F.raiseError(error)
  }

} 
Example 6
Source File: EitherTValues.scala    From guardrail   with MIT License 5 votes vote down vote up
package tests.scalatest

import cats.Functor
import cats.data.EitherT
import org.scalactic.source
import org.scalatest._
import org.scalatest.exceptions.{ StackDepthException, TestFailedException }
import scala.language.higherKinds
import scala.language.implicitConversions

trait EitherTValues {

  implicit def convertEitherTToValuable[F[_]: Functor, L, R](eitherT: EitherT[F, L, R]) = new EitherTValuable(eitherT)

  class EitherTValuable[F[_]: Functor, L, R](eitherT: EitherT[F, L, R]) {
    def leftValue(implicit pos: source.Position): F[L] =
      eitherT.fold(identity, { _ =>
        throw new TestFailedException((_: StackDepthException) => Option.empty[String], Option.empty[Throwable], pos)
      })

    def rightValue(implicit pos: source.Position): F[R] =
      eitherT.fold({ _ =>
        throw new TestFailedException((_: StackDepthException) => Option.empty[String], Option.empty[Throwable], pos)
      }, identity)
  }
} 
Example 7
Source File: EitherTValues.scala    From guardrail   with MIT License 5 votes vote down vote up
package tests.scalatest

import cats.Functor
import cats.data.EitherT
import org.scalactic.source
import org.scalatest._
import org.scalatest.exceptions.{ StackDepthException, TestFailedException }
import scala.language.higherKinds
import scala.language.implicitConversions

trait EitherTValues {

  implicit def convertEitherTToValuable[F[_]: Functor, L, R](eitherT: EitherT[F, L, R]) = new EitherTValuable(eitherT)

  class EitherTValuable[F[_]: Functor, L, R](eitherT: EitherT[F, L, R]) {
    def leftValue(implicit pos: source.Position): F[L] =
      eitherT.fold(identity, { _ =>
        throw new TestFailedException((_: StackDepthException) => Option.empty[String], Option.empty[Throwable], pos)
      })

    def rightValue(implicit pos: source.Position): F[R] =
      eitherT.fold({ _ =>
        throw new TestFailedException((_: StackDepthException) => Option.empty[String], Option.empty[Throwable], pos)
      }, identity)
  }
} 
Example 8
Source File: EitherTValues.scala    From guardrail   with MIT License 5 votes vote down vote up
package tests.scalatest

import cats.Functor
import cats.data.EitherT
import org.scalactic.source
import org.scalatest._
import org.scalatest.exceptions.{ StackDepthException, TestFailedException }
import scala.language.higherKinds
import scala.language.implicitConversions

trait EitherTValues {

  implicit def convertEitherTToValuable[F[_]: Functor, L, R](eitherT: EitherT[F, L, R]) = new EitherTValuable(eitherT)

  class EitherTValuable[F[_]: Functor, L, R](eitherT: EitherT[F, L, R]) {
    def leftValue(implicit pos: source.Position): F[L] =
      eitherT.fold(identity, { _ =>
        throw new TestFailedException((_: StackDepthException) => Option.empty[String], Option.empty[Throwable], pos)
      })

    def rightValue(implicit pos: source.Position): F[R] =
      eitherT.fold({ _ =>
        throw new TestFailedException((_: StackDepthException) => Option.empty[String], Option.empty[Throwable], pos)
      }, identity)
  }
} 
Example 9
Source File: IOEitherValues.scala    From nexus   with Apache License 2.0 5 votes vote down vote up
package ch.epfl.bluebrain.nexus.storage.utils

import cats.effect.IO
import org.scalactic.source
import org.scalatest.matchers.should.Matchers.fail

import scala.reflect.ClassTag

trait IOEitherValues extends IOValues with EitherValues {

  implicit final def ioEitherValues[E, A](io: IO[Either[E, A]]): IOEitherValuesSyntax[E, A] =
    new IOEitherValuesSyntax(io)

  protected class IOEitherValuesSyntax[E, A](io: IO[Either[E, A]]) {
    def accepted(implicit config: PatienceConfig, pos: source.Position): A =
      io.ioValue(config, pos).rightValue

    def rejected[EE <: E: ClassTag](implicit config: PatienceConfig, pos: source.Position): EE = {
      val EE = implicitly[ClassTag[EE]]
      io.ioValue(config, pos).leftValue match {
        case EE(value) => value
        case other     =>
          fail(
            s"Wrong throwable type caught, expected: '${EE.runtimeClass.getName}', actual: '${other.getClass.getName}'"
          )
      }
    }
  }
}

object IOEitherValues extends IOEitherValues 
Example 10
Source File: Consume.scala    From daml   with Apache License 2.0 5 votes vote down vote up
// Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package com.daml.http

import akka.stream.scaladsl.Sink
import org.scalactic.source
import scalaz.{~>, Functor}

import scala.concurrent.{ExecutionContext, Future}


  def interpret[T, V](steps: FCC[T, V])(implicit ec: ExecutionContext): Sink[T, Future[V]] =
    Sink
      .foldAsync(steps) { (steps, t: T) =>
        // step through steps until performing exactly one listen,
        // then step through any further steps until encountering
        // either the end or the next listen
        def go(steps: FCC[T, V], listened: Boolean): Future[FCC[T, V]] =
          steps.resume fold ({
            case listen @ Listen(f, _) =>
              if (listened) Future successful (Free roll listen) else go(f(t), true)
            case drain: Drain[s, T, FCC[T, V]] =>
              Future successful Free.roll {
                if (listened) drain
                else drain.copy(init = drain.next(drain.init, t))
              }
            case Emit(run) => run flatMap (go(_, listened))
          }, v =>
            if (listened) Future successful (Free point v)
            else
              Future.failed(new IllegalStateException(
                s"unexpected element $t, script already terminated with $v")))
        go(steps, false)
      }
      .mapMaterializedValue(_.flatMap(_.foldMap(Lambda[Consume[T, ?] ~> Future] {
        case Listen(_, desc) =>
          Future.failed(new IllegalStateException(
            s"${describe(desc)}: script terminated early, expected another value"))
        case Drain(init, _, out) => Future(out(init))
        case Emit(run) => run
      })))

  implicit def `consume functor`[T](implicit ec: ExecutionContext): Functor[Consume[T, ?]] =
    new Functor[Consume[T, ?]] {
      override def map[A, B](fa: Consume[T, A])(f: A => B): Consume[T, B] = fa match {
        case Listen(g, desc) => Listen(g andThen f, desc)
        case Drain(init, next, out) => Drain(init, next, out andThen f)
        case Emit(run) => Emit(run map f)
      }
    }

  private def describe(d: Description) = s"${d.fileName}:${d.lineNumber}"

  implicit final class `Consume Ops`[T, V](private val steps: FCC[T, V]) extends AnyVal {
    def withFilter(p: V => Boolean)(implicit pos: source.Position): Free[Consume[T, ?], V] =
      steps flatMap { v =>
        if (p(v)) Free point v
        else
          Free liftF Emit(
            Future failed new IllegalStateException(
              s"${describe(pos)}: script cancelled by match error on $v"))
      }
  }

  def syntax[T]: Syntax[T] = new Syntax

  final class Syntax[T] {
    def readOne(implicit pos: source.Position): FCC[T, T] = Free liftF Listen(identity, pos)
    def drain: FCC[T, Seq[T]] =
      Free liftF Drain(Nil, (acc: List[T], t) => t :: acc, (_: List[T]).reverse)
    def liftF[V](run: Future[V]): FCC[T, V] = Free liftF Emit(run)
    def point[V](v: V): FCC[T, V] = Free point v
  }
} 
Example 11
Source File: IOValues.scala    From nexus   with Apache License 2.0 5 votes vote down vote up
package ch.epfl.bluebrain.nexus.storage.utils

import cats.effect.IO
import org.scalactic.source
import org.scalatest.matchers.should.Matchers._
import org.scalatest.concurrent.ScalaFutures

import scala.reflect.ClassTag

trait IOValues extends ScalaFutures {
  implicit final def ioValues[A](io: IO[A]): IOValuesSyntax[A] =
    new IOValuesSyntax(io)

  protected class IOValuesSyntax[A](io: IO[A]) {
    def failed[Ex <: Throwable: ClassTag](implicit config: PatienceConfig, pos: source.Position): Ex = {
      val Ex = implicitly[ClassTag[Ex]]
      io.redeemWith(
          {
            case Ex(ex) => IO.pure(ex)
            case other  =>
              IO(
                fail(
                  s"Wrong throwable type caught, expected: '${Ex.runtimeClass.getName}', actual: '${other.getClass.getName}'"
                )
              )
          },
          a => IO(fail(s"The IO did not fail as expected, but computed the value '$a'"))
        )
        .ioValue(config, pos)
    }

    def ioValue(implicit config: PatienceConfig, pos: source.Position): A =
      io.unsafeToFuture().futureValue(config, pos)
  }
}

object IOValues extends IOValues 
Example 12
Source File: IOEitherValues.scala    From nexus   with Apache License 2.0 5 votes vote down vote up
package ch.epfl.bluebrain.nexus.util

import cats.effect.IO
import org.scalactic.source
import org.scalatest.matchers.should.Matchers.fail

import scala.reflect.ClassTag

trait IOEitherValues extends IOValues with EitherValues {

  implicit final def ioEitherValues[E, A](io: IO[Either[E, A]]): IOEitherValuesSyntax[E, A] =
    new IOEitherValuesSyntax(io)

  protected class IOEitherValuesSyntax[E, A](io: IO[Either[E, A]]) {
    def accepted(implicit config: PatienceConfig, pos: source.Position): A =
      io.ioValue(config, pos).rightValue

    def rejected[EE <: E: ClassTag](implicit config: PatienceConfig, pos: source.Position): EE = {
      val EE = implicitly[ClassTag[EE]]
      io.ioValue(config, pos).leftValue match {
        case EE(value) => value
        case other     =>
          fail(
            s"Wrong throwable type caught, expected: '${EE.runtimeClass.getName}', actual: '${other.getClass.getName}'"
          )
      }
    }
  }
}

object IOEitherValues extends IOEitherValues 
Example 13
Source File: EitherValues.scala    From nexus   with Apache License 2.0 5 votes vote down vote up
package ch.epfl.bluebrain.nexus.util

import org.scalactic.source
import org.scalatest.exceptions.{StackDepthException, TestFailedException}

trait EitherValues {

  class EitherValuable[L, R](either: Either[L, R], pos: source.Position) {
    def rightValue: R =
      either match {
        case Right(value) => value
        case Left(_)      =>
          throw new TestFailedException(
            (_: StackDepthException) => Some("The Either value is not a Right(_)"),
            None,
            pos
          )
      }

    def leftValue: L =
      either match {
        case Left(value) => value
        case Right(_)    =>
          throw new TestFailedException(
            (_: StackDepthException) => Some("The Either value is not a Left(_)"),
            None,
            pos
          )
      }
  }

  implicit def convertEitherToValuable[L, R](either: Either[L, R])(implicit p: source.Position): EitherValuable[L, R] =
    new EitherValuable(either, p)

}

object EitherValues extends EitherValues 
Example 14
Source File: IOValues.scala    From nexus   with Apache License 2.0 5 votes vote down vote up
package ch.epfl.bluebrain.nexus.util

import cats.effect.IO
import org.scalactic.source
import org.scalatest.matchers.should.Matchers._
import org.scalatest.concurrent.ScalaFutures

import scala.reflect.ClassTag

trait IOValues extends ScalaFutures {
  implicit final def ioValues[A](io: IO[A]): IOValuesSyntax[A] =
    new IOValuesSyntax(io)

  protected class IOValuesSyntax[A](io: IO[A]) {
    def failed[Ex <: Throwable: ClassTag](implicit config: PatienceConfig, pos: source.Position): Ex = {
      val Ex = implicitly[ClassTag[Ex]]
      io.redeemWith(
          {
            case Ex(ex) => IO.pure(ex)
            case other  =>
              IO(
                fail(
                  s"Wrong throwable type caught, expected: '${Ex.runtimeClass.getName}', actual: '${other.getClass.getName}'"
                )
              )
          },
          a => IO(fail(s"The IO did not fail as expected, but computed the value '$a'"))
        )
        .ioValue(config, pos)
    }

    def ioValue(implicit config: PatienceConfig, pos: source.Position): A =
      io.unsafeToFuture().futureValue(config, pos)
  }
}

object IOValues extends IOValues 
Example 15
Source File: SourcingSpec.scala    From nexus   with Apache License 2.0 5 votes vote down vote up
package ch.epfl.bluebrain.nexus.sourcing

import org.scalactic.source
import org.scalatest.{Inspectors, OptionValues, TryValues}
import org.scalatest.exceptions.{StackDepthException, TestFailedException}
import org.scalatest.matchers.should.Matchers

trait SourcingSpec
    extends org.scalatest.wordspec.AnyWordSpecLike
    with Matchers
    with Inspectors
    with OptionValues
    with TryValues {

  class EitherValuable[L, R](either: Either[L, R], pos: source.Position) {
    def rightValue: R =
      either match {
        case Right(value) => value
        case Left(_)      =>
          throw new TestFailedException(
            (_: StackDepthException) => Some("The Either value is not a Right(_)"),
            None,
            pos
          )
      }

    def leftValue: L =
      either match {
        case Left(value) => value
        case Right(_)    =>
          throw new TestFailedException(
            (_: StackDepthException) => Some("The Either value is not a Left(_)"),
            None,
            pos
          )
      }
  }

  implicit def convertEitherToValuable[L, R](either: Either[L, R])(implicit p: source.Position): EitherValuable[L, R] =
    new EitherValuable(either, p)

} 
Example 16
Source File: IOValues.scala    From nexus   with Apache License 2.0 5 votes vote down vote up
package ch.epfl.bluebrain.nexus.sourcing.projections

import cats.effect.IO
import org.scalactic.source
import org.scalatest.matchers.should.Matchers._
import org.scalatest.concurrent.ScalaFutures

import scala.reflect.ClassTag

trait IOValues extends ScalaFutures {
  implicit final def ioValues[A](io: IO[A]): IOValuesSyntax[A] =
    new IOValuesSyntax(io)

  protected class IOValuesSyntax[A](io: IO[A]) {
    def failed[Ex <: Throwable: ClassTag](implicit config: PatienceConfig, pos: source.Position): Ex = {
      val Ex = implicitly[ClassTag[Ex]]
      io.redeemWith(
          {
            case Ex(ex) => IO.pure(ex)
            case other  =>
              IO(
                fail(
                  s"Wrong throwable type caught, expected: '${Ex.runtimeClass.getName}', actual: '${other.getClass.getName}'"
                )
              )
          },
          a => IO(fail(s"The IO did not fail as expected, but computed the value '$a'"))
        )
        .ioValue(config, pos)
    }

    def ioValue(implicit config: PatienceConfig, pos: source.Position): A =
      io.unsafeToFuture().futureValue(config, pos)
  }
}

object IOValues extends IOValues 
Example 17
Source File: LiteralTypeTests.scala    From scala-tsi   with MIT License 5 votes vote down vote up
package com.scalatsi

import TypescriptType.{TSLiteralBoolean, TSLiteralNumber, TSLiteralString}
import org.scalactic.source
import org.scalatest.words.StringVerbBlockRegistration
import org.scalatest.{Matchers, WordSpec}

class LiteralTypeTests extends WordSpec with Matchers with DefaultTSTypes {

  "Default TS Types should be defined" forWord {
    "literal booleans" in {
      TSType.get[true] shouldBe TSType(TSLiteralBoolean(true))
      TSType.get[false] shouldBe TSType(TSLiteralBoolean(false))
    }

    "literal strings" in {
      TSType.get["Hello world!"] shouldBe TSType(TSLiteralString("Hello world!"))
    }

    "literal numbers" in {
      TSType.get[42] shouldBe TSType(TSLiteralNumber(BigDecimal(42)))
      TSType.get[42L] shouldBe TSType(TSLiteralNumber(BigDecimal(42L)))
      TSType.get[42.0] shouldBe TSType(TSLiteralNumber(BigDecimal(42.0)))
      TSType.get[42.0f] shouldBe TSType(TSLiteralNumber(BigDecimal(42.0f)))
    }
  }

  "Literal numbers" should {
    "work in other types" in {
      case class Literal(
        a: "Hello!",
        b: 42,
        c: true
      )

      implicit val tsType = TSType.fromCaseClass[Literal]

      TypescriptTypeSerializer.emit[Literal]() shouldBe
        """export interface ILiteral {
          |  a: "Hello!"
          |  b: 42
          |  c: true
          |}
          |""".stripMargin
    }
  }

  import scala.language.implicitConversions
  implicit def convertToStringHasWrapperForVerb(o: String)(implicit position: source.Position): HasWrapper =
    new HasWrapper {
      override val leftSideString = o.trim
      override val pos            = position
    }

  trait HasWrapper {
    val leftSideString: String
    val pos: source.Position

    def forWord(right: => Unit)(implicit fun: StringVerbBlockRegistration): Unit = {
      fun(leftSideString, "for", pos, () => right)
    }
  }
} 
Example 18
Source File: EqualsAuthenticatedRequest.scala    From nisp-frontend   with Apache License 2.0 5 votes vote down vote up
package uk.gov.hmrc.nisp.utils

import org.mockito.ArgumentMatcher
import org.scalactic.{Prettifier, source}
import org.scalatest.Matchers
import uk.gov.hmrc.nisp.controllers.auth.AuthenticatedRequest

case class EqualsAuthenticatedRequest(n: AuthenticatedRequest[_])
  extends ArgumentMatcher[AuthenticatedRequest[_]] with Matchers {

  class LocalPrettifier extends Prettifier {
    override def apply(o: Any): String = {
      o match {
        case request: AuthenticatedRequest[_] =>
          s"AuthenticatedRequest { request: ${request.request}, nispAuthedUser: ${request.nispAuthedUser}, authDetails: ${request.authDetails}"
        case _ => o.toString
      }
    }
  }

  override implicit def convertToAnyShouldWrapper[AuthenticatedRequest]
  (o: AuthenticatedRequest)
  (implicit pos: source.Position, prettifier: Prettifier): AnyShouldWrapper[AuthenticatedRequest] =
    new AnyShouldWrapper(o, pos, new LocalPrettifier)

  override def matches(argument: AuthenticatedRequest[_]): Boolean = {
    withClue(s"Argument doesn't match: ") {
      argument shouldBe n
    }
    true
  }
}