我在Lagom中有我的Asset api和asset impl。我想从另一个服务预订显示发送标题。我通过使用“ handleRequestHeader”做到了。我正在编写测试用例以进行预订,并且无法在测试用例中发送标头。
AssetService- API
def getAsset(assetID: String): ServiceCall[NotUsed, GetAssetResponse]
AssetService-impl
override def getAsset(assetID: String): ServerServiceCall[NotUsed, GetAssetResponse] = ServerServiceCall
在测试案例中,有人可以帮助我如何从预订中将requsetheader发送到资产吗?
我尝试使用
Mockito.when(assetService.getAsset(ValidAssetID)
.handleRequestHeader(request => request.withHeader(HeaderName, booking.user.id)).invoke())
.thenReturn(Future.successful(assetResponse))