spring - Junit Mockito:How to Pass parameters: Arraylist,int value to Rest Junit API -
i writing junit rest api , have junit test method below snippet , can 1 tell me how can pass arraylist , int type of data when using mockito. can please tell me. test invocation eg:
` list<myuser> myuserlist = new arraylist<myuser>(); myuser user1 = new usrhelper().create(); myuser user2 = new usrhelper().create(); myuserlist.add(user1); myuserlist.add(user2); mvcresult result =mockmvc.perform(post("/test1/test2/test3").contenttype(mediatype.application_json).content(jsonutils.tojsonstring(myuserlist)).param("myuserid", 1234).param("id", "abcd123")).andexpect(status().isok()).andreturn();`
in above myuserlist arraylist , myuserid - int value. please let me know.
i got soultion , mapping parameter passed correctly. wrong parameter name (myuserid) passed. got fixed problem.thank you
Comments
Post a Comment