Skip to content

Commit

Permalink
[refactor/InhaBas#179] SignUp 완료로 이전 주석처리한 Menu 코드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
whitem4rk committed Dec 13, 2023
1 parent c7502fa commit 5030a8c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,35 +34,34 @@ public void setUp() {

}

// @DisplayName("새로운 메뉴를 만든다.")
// @Test
// public void CreateNewMenu() {
// //given
// MenuGroup menuGroup1 = em.persist(new MenuGroup("IBAS"));
// Menu activityBoardMenu = new Menu(menuGroup1, 1, MenuType.LIST, "동아리 활동", "동아리원의 활동을 기록하는 게시판입니다.");
//
// //when
// Menu saveActivityMenu = menuRepository.save(activityBoardMenu);
// em.flush();
//
// //then
// assertThat(saveActivityMenu.getId()).isNotNull();
// assertThat(saveActivityMenu.getDateCreated()).isNotNull();
// assertThat(saveActivityMenu.getDateUpdated()).isNotNull();
// assertThat(saveActivityMenu)
// .usingRecursiveComparison()
// .ignoringFields("id", "dateCreated", "dateUpdated")
// .isEqualTo(activityBoardMenu);
// }
@DisplayName("새로운 메뉴를 만든다.")
@Test
public void CreateNewMenu() {
//given
MenuGroup menuGroup1 = em.persist(new MenuGroup("IBAS"));
Menu activityBoardMenu = new Menu(menuGroup1, 1, MenuType.LIST, "동아리 활동", "동아리원의 활동을 기록하는 게시판입니다.");

//when
Menu saveActivityMenu = menuRepository.save(activityBoardMenu);
em.flush();

//then
assertThat(saveActivityMenu.getId()).isNotNull();
assertThat(saveActivityMenu.getDateCreated()).isNotNull();
assertThat(saveActivityMenu.getDateUpdated()).isNotNull();
assertThat(saveActivityMenu)
.usingRecursiveComparison()
.ignoringFields("id", "dateCreated", "dateUpdated")
.isEqualTo(activityBoardMenu);
}

@Disabled
@DisplayName("메뉴 이름을 수정한다.")
@Test
public void updateMenuName() {
//given
MenuGroup menuGroup1 = em.persist(new MenuGroup("IBAS"));
MenuGroup menuGroup2 = em.persist(new MenuGroup("게시판 목록"));
Menu noticeMenu = menuRepository.save(new Menu(menuGroup2, 1, MenuType.LIST, "공지사항", "동아리 공지를 게시하는 게시판입니다."));
MenuGroup menuGroup = em.persist(new MenuGroup("게시판 목록"));
Menu noticeMenu = menuRepository.save(new Menu(menuGroup, 1, MenuType.LIST, "공지사항", "동아리 공지를 게시하는 게시판입니다."));

//when
String newName = "공지 사항";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ public class MenuControllerTest {
@Autowired
private MockMvc mvc;

// @DisplayName("모든 메뉴 정보를 조회한다.")
// @Test
// public void getTotalMenuInfoTest() throws Exception {
// given(menuService.getAllMenuInfo()).willReturn(
// List.of(new MenuGroupDto(1, "IBAS", List.of(new MenuDto(new MenuId(6),1,"동아리 소개",MenuType.INTRODUCE, "")))));
//
// mvc.perform(get("/menus"))
// .andDo(print())
// .andExpect(status().isOk())
// .andExpect(content().string("[{\"id\":1,\"groupName\":\"IBAS\",\"menuList\":[{\"menuId\":6,\"priority\":1,\"name\":\"ë\u008F\u0099ì\u0095\u0084리 ì\u0086\u008Cê°\u009C\",\"type\":\"INTRODUCE\",\"description\":\"\"}]}]"))
// .andReturn();
//
// then(menuService).should(times(1)).getAllMenuInfo();
// }
@DisplayName("모든 메뉴 정보를 조회한다.")
@Test
public void getTotalMenuInfoTest() throws Exception {
given(menuService.getAllMenuInfo()).willReturn(
List.of(new MenuGroupDto(1, "IBAS", List.of(new MenuDto(new MenuId(6),1,"동아리 소개",MenuType.INTRODUCE, "")))));

mvc.perform(get("/menus"))
.andDo(print())
.andExpect(status().isOk())
.andExpect(content().string("[{\"id\":1,\"groupName\":\"IBAS\",\"menuList\":[{\"menuId\":6,\"priority\":1,\"name\":\"ë\u008F\u0099ì\u0095\u0084리 ì\u0086\u008Cê°\u009C\",\"type\":\"INTRODUCE\",\"description\":\"\"}]}]"))
.andReturn();

then(menuService).should(times(1)).getAllMenuInfo();
}

@DisplayName("단일 메뉴 정보를 조회한다.")
@Test
Expand Down

0 comments on commit 5030a8c

Please sign in to comment.