7
JSONペイロードを持つ/ users URLでPOSTリクエストを実行してユーザーを作成するための基本テストを作成したいと思います。JSONオブジェクトを作成してSpringブートテストで投稿する
@Test public void createUser() throws Exception {
String userJson = new User("My new User", "[email protected]").toJson();
this.mockMvc.perform(post("https://stackoverflow.com/users/").contentType(userJson)).andExpect(status().isCreated());
あなたを助けることを願って:O) – chocksaway