-1
  def getSessionDetails(
      sessionId: String,
      expectedStatus: String = "success"
  ) = {
    exec(
      http("/cap/getSessionDetails")
        .get("/cap/getSessionDetails.do")
        .queryParam("sessionID", sessionId)
        .check(status.in(200))
        .check(jsonPath("$.status").is(expectedStatus))
        .check(
          jsonPath("$.data.sessionTimes[0].enrollmentStatus").find
            .saveAs("enrollmentStatus")
        )
        .check(
          jsonPath("$.data.sessionTimes[0].id").find.saveAs("sessionTimeID")
        )
    ).exec { session => println(session) session }

  }

I am trying to get values to print for debugging, but no matter where I put the println line of code in this block, I get some kind of error. Right now as it is, I get "value session is not a member of Unit". Looking at other examples, I can't tell where mine is different.

TheLionPear
  • 89
  • 1
  • 2
  • 12
  • 2
    Add a semicolon `;` after the `println()`. – jwvh Oct 24 '19 at 22:14
  • @jwvh That worked. And when I look at my resources, they have a semi-colon too which I was using to begin with. But it wasn't working so that was one of the things I tried changing. I'm not sure why it works with it now, but thank you very much. – TheLionPear Oct 24 '19 at 22:22

1 Answers1

1

In your line .exec { session => println(session) session }, you should insert a semicolon or a line break after println(session).

Otherwise, you are trying to call session on the return value of println(..), which is of type Unit. However, Unit (something like 'void' in Java), does not have such a member.

How are you calling it? Postfix notation in scala allows you to call methods without parameters by writing object method instead of object.method() (read more under https://docs.scala-lang.org/style/method-invocation.html).

ben
  • 58
  • 5