fastcampus-eatgo icon indicating copy to clipboard operation
fastcampus-eatgo copied to clipboard

18. 가게수정 동영상 전 코드 누락여부

Open kyeongminlee opened this issue 5 years ago • 3 comments

안녕하세요, 패스트캠퍼스 강의 잘 듣고있습니다.

강의를 따라하던 중에 갑자기 없던 코드가 나타나서 문의드릴 곳이 마땅히 없어서 여기에 문의드니다.

RestaurantControllerTest class에서

@Test
    public void create() throws Exception {
        mvc.perform(post("/restaurants")
                .contentType(MediaType.APPLICATION_JSON)
                .content("{\"name\":\"Beryong\", \"address\": \"Busan\"}"))
                .andExpect(status().isCreated())
                .andExpect(header().string("location", "/restaurants/1234"))
                .andExpect(content().string("{}"))
                .andDo(print());

        verify(restaurantService).addRestaurant(any());
    }

14강 가게 추가 -1 마지막 부분에 위와 같이 설명해주셨고 그 이후에 14강과 18강 사이에 해당 클래스를 수정한 내용이 없는것 같은데 18강 초반 부분에 아래와 같이 코드가 변경되어 있습니다.

@Test
    public void create() throws Exception {
        given(restaurantService.addRestaurant(any())).will(invocation -> {
            Restaurant restaurant = invocation.getArgument(0);
            return Restaurant.builder()
                    .id(1234L)
                    .name(restaurant.getName())
                    .address(restaurant.getAddress())
                    .build();
        });

        mvc.perform(post("/restaurants")
                .contentType(MediaType.APPLICATION_JSON)
                .content("{\"name\":\"Beryong\", \"address\": \"Busan\"}"))
                .andExpect(status().isCreated())
                .andExpect(header().string("location", "/restaurants/1234"))
                .andExpect(content().string("{}"))
                .andDo(print());

        verify(restaurantService).addRestaurant(any());
    }

위와 같이 코드를 수정하는 부분이 누락된것인지 아니면 제가 못찾은 것인지 확인좀 부탁드립니다.

kyeongminlee avatar Nov 29 '19 02:11 kyeongminlee

안녕하세요. 편집 과정에서 해당 내용이 빠진 것 같네요. 해당 부분을 따로 A/S 영상으로 제작해 드리겠습니다. 감사합니다.

ahastudio avatar Nov 29 '19 02:11 ahastudio

음 저도 못찾다가 19강 Lombok강의에서 builder로 바꾸는 것에서 발견하고 수정했습니다.

hannut91 avatar Dec 09 '19 14:12 hannut91

안녕하세요 혹시 a/s 강의 어디서 찾을 수 있는지 알 수 있을까요 .. 🥲 !!

minhee0327 avatar May 14 '21 15:05 minhee0327