Package org.sonarqube.ws.client
Class MockWsResponse
java.lang.Object
org.sonarqube.ws.client.MockWsResponse
- All Implemented Interfaces:
Closeable
,AutoCloseable
,WsResponse
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
int
code()
HTTP status codecontent()
static MockWsResponse
createJson
(String json) Throws aHttpException
ifWsResponse.isSuccessful()
is false.boolean
boolean
Returns true if the code is in [200..300), which means the request was successfully received, understood, and accepted.The absolute requested URLsetCode
(int code) setContent
(byte[] b) setContent
(String s) setContentType
(String contentType) setExpirationDate
(String expirationDate) setRequestUrl
(String requestUrl)
-
Constructor Details
-
MockWsResponse
public MockWsResponse()
-
-
Method Details
-
code
public int code()Description copied from interface:WsResponse
HTTP status code -
setCode
-
contentType
-
header
-
setContentType
-
setExpirationDate
-
setRequestUrl
-
setContent
-
setContent
-
hasContent
public boolean hasContent()- Specified by:
hasContent
in interfaceWsResponse
-
requestUrl
Description copied from interface:WsResponse
The absolute requested URL -
contentStream
-
contentReader
-
content
-
createJson
-
isSuccessful
public boolean isSuccessful()Description copied from interface:WsResponse
Returns true if the code is in [200..300), which means the request was successfully received, understood, and accepted.- Specified by:
isSuccessful
in interfaceWsResponse
-
failIfNotSuccessful
Description copied from interface:WsResponse
Throws aHttpException
ifWsResponse.isSuccessful()
is false.- Specified by:
failIfNotSuccessful
in interfaceWsResponse
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceWsResponse
-