List of usage examples for com.squareup.okhttp ResponseBody create
public static ResponseBody create(final MediaType contentType, byte[] content)
From source file:retrofit.ResponseTest.java
License:Apache License
@Test public void errorWithNullRawResponseThrows() { ResponseBody errorBody = ResponseBody.create(null, "Broken!"); try {/*from ww w. j av a 2 s . c o m*/ Response.error(errorBody, null); fail(); } catch (NullPointerException e) { assertThat(e).hasMessage("rawResponse == null"); } }
From source file:retrofit.ResponseTest.java
License:Apache License
@Test public void errorWithSuccessRawResponseThrows() { ResponseBody errorBody = ResponseBody.create(null, "Broken!"); try {/*from www . ja va 2 s. c o m*/ Response.error(errorBody, successResponse); fail(); } catch (IllegalArgumentException e) { assertThat(e).hasMessage("rawResponse should not be successful response"); } }