Package org.sonarqube.ws.client
Class MockWsResponse
java.lang.Object
org.sonarqube.ws.client.MockWsResponse
- All Implemented Interfaces:
Closeable,AutoCloseable,WsResponse
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intcode()HTTP status codecontent()static MockWsResponsecreateJson(String json) Throws aHttpExceptionifWsResponse.isSuccessful()is false.booleanheaders()booleanReturns 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:WsResponseHTTP status code -
setCode
-
contentType
-
header
-
headers
-
setContentType
-
setExpirationDate
-
setRequestUrl
-
setContent
-
setContent
-
setHeader
-
hasContent
public boolean hasContent()- Specified by:
hasContentin interfaceWsResponse
-
requestUrl
Description copied from interface:WsResponseThe absolute requested URL -
contentStream
-
contentReader
-
content
-
createJson
-
isSuccessful
public boolean isSuccessful()Description copied from interface:WsResponseReturns true if the code is in [200..300), which means the request was successfully received, understood, and accepted.- Specified by:
isSuccessfulin interfaceWsResponse
-
failIfNotSuccessful
Description copied from interface:WsResponseThrows aHttpExceptionifWsResponse.isSuccessful()is false.- Specified by:
failIfNotSuccessfulin interfaceWsResponse
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceWsResponse
-