Skip to content

Commit

Permalink
test: CI 에러 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
youKeon committed Oct 27, 2023
1 parent dff2bde commit 429c919
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.data.redis.core.HashOperations;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -56,6 +57,8 @@ class ProjectServiceTest extends MockTest {

@Mock
private CustomUserDetailsService customUserDetailsService;
@Mock
HashOperations hashOperations;

@InjectMocks
private ProjectService projectService;
Expand Down Expand Up @@ -86,14 +89,15 @@ void updateProject() throws Exception {
Tag tag1 = Tag.builder().tech("Vue").build();
Tag tag2 = Tag.builder().tech("Java").build();


//when
when(projectRepository.findById(project.getId())).thenReturn(Optional.of(project));
when(tagService.findTagListByName(techTags)).thenReturn(new Tags(List.of(tag1, tag2)));
when(redisRankingTemplate.opsForHash()).thenReturn(hashOperations);

UpdateProjectResponse result = projectService.modifyProject(project.getId(), request);

assertThat(result.getProjectName()).isEqualTo(project.getProjectName());
//then
assertThat(result.getProjectName()).isEqualTo("afterUpdate"); // 수정된 부분
assertThat(result.getDescription()).isEqualTo(project.getDescription());
assertThat(result.getThumbNail()).isEqualTo(project.getThumbNail());
assertThat(result.getTechTags()).isEqualTo(new ArrayList<>(Arrays.asList("Vue", "Java")));
Expand Down Expand Up @@ -177,6 +181,7 @@ void getProjects() throws Exception {
@DisplayName("프로젝트 삭제")
void deleteProject() throws Exception {
//when
when(redisRankingTemplate.opsForHash()).thenReturn(hashOperations);
projectService.removeProject(1L);

//then
Expand Down

0 comments on commit 429c919

Please sign in to comment.