File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
src/test/java/dmu/dasom/api/domain/executive/service Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 33import dmu .dasom .api .domain .executive .dto .ExecutiveCreationResponseDto ;
44import dmu .dasom .api .domain .executive .dto .ExecutiveRequestDto ;
55import dmu .dasom .api .domain .executive .dto .ExecutiveResponseDto ;
6+ import dmu .dasom .api .domain .executive .dto .ExecutiveUpdateRequestDto ;
67import dmu .dasom .api .domain .executive .entity .ExecutiveEntity ;
78import dmu .dasom .api .domain .executive .repository .ExecutiveRepository ;
89import org .junit .jupiter .api .DisplayName ;
@@ -79,4 +80,34 @@ void createExecutive_success() {
7980 // then
8081 assertThat (responseDto .getId ()).isEqualTo (id );
8182 }
83+
84+ @ Test
85+ @ DisplayName ("임원진 멤버 수정 - 성공" )
86+ void updateExecutive_success () {
87+
88+ //given
89+ Long id = 1L ;
90+
91+ ExecutiveEntity entity = ExecutiveEntity .builder ()
92+ .id (1L )
93+ .name ("김다솜" )
94+ .position ("회장" )
95+ .githubUrl ("https://github.com/dasom" )
96+ .build ();
97+
98+ ExecutiveUpdateRequestDto updateEntity = new ExecutiveUpdateRequestDto ("김솜다" , "부회장" , "https://github.com/dasom" );
99+
100+ when (executiveRepository .findById (id )).thenReturn (Optional .of (entity ));
101+
102+ //when
103+ ExecutiveResponseDto updateExecutive = executiveService .updateExecutive (id , updateEntity );
104+
105+ //then
106+ assertThat (updateExecutive .getName ()).isEqualTo ("김솜다" );
107+ assertThat (updateExecutive .getPosition ()).isEqualTo ("부회장" );
108+ assertThat (updateExecutive .getGithubUrl ()).isEqualTo ("https://github.com/dasom" );
109+
110+ // verify ( 호출 검증 )
111+ verify (executiveRepository , times (1 )).findById (id ); // 메소드를 정확히 한 번만 호출했는지?
112+ }
82113}
You can’t perform that action at this time.
0 commit comments