I have a simple test in which I was testing if the POST of a json is successful. This was my test:
int expectedCodeResponse = 201;
Map<String, String> params = new HashMap<String, String>();
params.put("batchPublicId", "001");
params.put("fileSize", "2");
params.put("location", "{\\\"bucket\\\":\\\"blabla\\\"}");
params.put("title", "testInvoice");
JSONObject parameter = new JSONObject(params);
OkHttpClient httpClient = new OkHttpClient();
RequestBody body = RequestBody.create(JSON, parameter.toString());
Request request = new Request.Builder()
.url(environmentUrls.get("base_url") + "/invoices")
.post(body)
.addHeader("content-type", "application/json; charset=utf-8")
.build();
Response response = httpClient.newCall(request).execute();
Assert.assertEquals(response.code(), expectedCodeResponse);
Now it doesn't work anymore because fileSize is not a String anymore, it's an int. How can I solve this?