The following works, even though not ideally:
println("123 <----> " +
(When {
get(API_ROOT + "/title/" + book.title)
} Then {
statusCode(200)
//body("title", equalTo(book.title))
} Extract {
path("title")
}))
//prints '[test title]'
The following fails:
val titleResponse : String =
(When {
get(API_ROOT + "/title/" + book.title)
} Then {
statusCode(200)
//body("title", equalTo(book.title))
} Extract { // <---- not enough information to infer type variable T
path("title") // <---- not enough information to infer type variable T
}).contentToString()
The following is the class definition:
@Entity
class Book(
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
var id: Long,
@Column(nullable = false, unique = true)
var title: String,
@Column(nullable = false)
var author: String
)
If someone could suggest some modifications to fix my code I would appreciate.
Have a nice day.