### Question:
BaseRequest extends AbstractRequest<T> { @Override @NonNull public String getBodyContentType() { if (HTTP_METHOD_JSON_ALLOWED.contains(getMethod()) && getJsonObject() != null) { return getJsonContentType(); } return super.getBodyContentType(); } protected  BaseRequest(Builder builder); @NonNull String getJsonContentType(); @Override @NonNull String getBodyContentType(); @Nullable byte[] getJsonBody(); @Override @NonNull String getUrl(); @Nullable Object getJsonObject(); @Override @Nullable Map<String, String> getParams();  }### Answer:
@Test public void requestPostConstruct_contentType() throws Exception { BaseRequest.Builder<DummyResponse> builder = new BaseRequest.Builder<>(Request.Method.POST, url, DummyResponse.class); builder.json(dummyRequestObject); builder.headers(headers); BaseRequest<DummyResponse> baseRequest = builder.build(); assertTrue("The body should be json typed", baseRequest.getBodyContentType().contains("application/json")); assertNotNull(baseRequest.getBody()); }
@Test public void requestPostParamConstruct_contentType() throws Exception { BaseRequest.Builder<DummyResponse> builder = new BaseRequest.Builder<>(Request.Method.POST, url, DummyResponse.class); builder.parameters(parameters); builder.headers(headers); BaseRequest<DummyResponse> baseRequest = builder.build(); assertTrue("The body should not be json typed", baseRequest.getBodyContentType().contains("application/x-www-form-urlencoded")); assertNotNull(baseRequest.getBody()); }
@Test public void requestGetParamConstruct() throws Exception { BaseRequest.Builder<DummyResponse> builder = new BaseRequest.Builder<>(Request.Method.GET, url, DummyResponse.class); builder.parameters(parameters); builder.headers(headers); BaseRequest<DummyResponse> baseRequest = builder.build(); assertTrue("The body should not be json typed", baseRequest.getBodyContentType().contains("application/x-www-form-urlencoded")); assertNull(baseRequest.getBody()); }
@Test public void requestPatchParamConstruct_contentType() throws Exception { BaseRequest.Builder<DummyResponse> builder = new BaseRequest.Builder<>(Request.Method.PATCH, url, DummyResponse.class); builder.parameters(parameters); builder.headers(headers); BaseRequest<DummyResponse> baseRequest = builder.build(); assertTrue("The body should not be json typed", baseRequest.getBodyContentType().contains("application/x-www-form-urlencoded")); assertNotNull(baseRequest.getBody()); }