Tuesday, 15 January 2013

scala - spray-testkit === status passes whatever status is -


I have the following test spray testkit with scalatest and I do not understand why it passes every time regardless of the actual test conditions.

  import akka.actor._ import akka.event.LoggingReceive import akka.testkit.TestProbe import com.ss.rg.service.ad.AdImporterServiceActor. {GetImportStatus, StatusOfImport} import org.scalatest. {MustMatchers, WordSpecLike} import spray.http._ import spray.testkit.ScalatestRouteTest sq WordSpecLike with MustMatchers with AdServiceApiTest ScalatestRouteTest { "AdService REST API" { "should be post processed for imports with mandatory standards should" {val P = in TestProbe () Val addressServiceMock = system.actorOf (props (classOf [AdServiceActorMock], p.ref)) post ( "/ service / ad / import? AdId = 1") ~ & gt; New AdServiceApi (Address Service Mark) Root ~> Investigation should be handled (correct) // Disclaimer size must be 1 response.status === StatusCodes.NotAcceptable}}}  

Test passes even if that condition should be different and when I made failed to justify testing rejection ... error message is as follows:

  request was rejected, the response was HttpResponse (202 accepted, HttpEntity ( Text / plain; charset = UTF-8, has been accepted for the request process, but the process Riya is not fulfilled), list (), http / 1.1) org.scalatest.exceptions.TestFailedException:. HttpResponse request was rejected, the response has been had (202 accepted approved, HttpEntity (text / request for plain; charset = UTF-8, processing, but the processing has not been completed.), List (); HTTP / 1.1) spray testkit.ScalatestInterface $ class.failTest (ScalatestInterface.scala: 25)  

It seems that I am missing some important concept.

Can anyone explain?

Update: Working correctly

  the status should be equal (StatusCodes.Accepted)  

=== is not enough you have to write

  status === (Status dot non-attachable)  

or

  emphasize (status === conditioncode.no. can not be counted)  

No comments:

Post a Comment