forked from InhaBas/Inhabas.com-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refactor/InhaBas#179] questionnaire test 수정
- Loading branch information
Showing
2 changed files
with
50 additions
and
10 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
...est/java/com/inhabas/api/domain/questionnaire/repository/QuestionnaireRepositoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.inhabas.api.domain.questionnaire.repository; | ||
|
||
import com.inhabas.api.domain.questionnaire.domain.Questionnaire; | ||
import com.inhabas.testAnnotataion.DefaultDataJpaTest; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import static org.assertj.core.api.AssertionsForClassTypes.assertThat; | ||
|
||
@DefaultDataJpaTest | ||
class QuestionnaireRepositoryTest { | ||
|
||
@Autowired | ||
private QuestionnaireRepository questionnaireRepository; | ||
|
||
@Test | ||
@DisplayName("idList와 일치하는것이 몇개 포함되어 있는지 확인한다.") | ||
public void countByIdIn() { | ||
//given | ||
ArrayList<Questionnaire> questionnaireInDatabase = new ArrayList<>() {{ | ||
add(new Questionnaire(1L, "지원동기 및 목표를 기술해주세요.")); | ||
add(new Questionnaire(2L, "프로그래밍 관련 언어를 다루어 본 적이 있다면 적어주세요.")); | ||
add(new Questionnaire(3L, "빅데이터 관련 활동 혹은 공모전 관련 경험이 있다면 적어주세요.")); | ||
add(new Questionnaire(4L, "추후 희망하는 진로가 무엇이며, 동아리 활동이 진로에 어떠한 영향을 줄 것이라고 생각하나요?")); | ||
add(new Questionnaire(5L, "어떤 경로로 IBAS를 알게 되셨나요?")); | ||
}}; | ||
questionnaireRepository.saveAll(questionnaireInDatabase); | ||
|
||
//when | ||
List<Long> ids = List.of(1L, 2L, 3L); | ||
Long shouldBeThree = questionnaireRepository.countByIdIn(ids); | ||
|
||
//then | ||
assertThat(shouldBeThree).isEqualTo(3); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters