jeudi 28 mai 2015

testing FormDataParam with xls file

Hello i have this method that I need to test:

@POST @Path("/loadlocaleListfromxls")

@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response addCountryFromXSL(@FormDataParam("file") InputStream inFile) {
    try {
        CountryListTranslator.addCountries(inFile);
    } catch (Exception e) {
        e.printStackTrace();
        return Response.status(500).build();
    }
    return Response.ok().build();
}

And here is my test:

String location = System.getProperty("/src/integration/resources/file.xml" InputStream inputStream = new FileInputStream(l

RestAssured.given().multiPart("file", inputStream).when().post("www.postfile/post") .then().assertThat().statusCode(200);

the issue is it gets exception java.lang.refect.InvocationTargetException in invoker.java. Any idea?

Thanks for your help

Aucun commentaire:

Enregistrer un commentaire