-
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.
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
...lab/eattofit/profile/infrastructure/exerciseprofile/ExerciseProfileJpaRepositoryTest.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,48 @@ | ||
package com.flab.eattofit.profile.infrastructure.exerciseprofile; | ||
|
||
import com.flab.eattofit.profile.domain.exerciseprofile.ExerciseProfile; | ||
import org.junit.jupiter.api.DisplayNameGeneration; | ||
import org.junit.jupiter.api.DisplayNameGenerator; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) | ||
@SuppressWarnings("NonAsciiCharacters") | ||
@DataJpaTest | ||
class ExerciseProfileJpaRepositoryTest { | ||
|
||
@Autowired | ||
private ExerciseProfileJpaRepository exerciseProfileJpaRepository; | ||
|
||
@Test | ||
void 회원_운동_정보_프로필을_저장한다() { | ||
// given | ||
Long memberId = 1L; | ||
ExerciseProfile exerciseProfile = ExerciseProfile.createWith("처음", "주 1회", "근비대", "초보자", memberId); | ||
|
||
// when | ||
ExerciseProfile savedProfile = exerciseProfileJpaRepository.save(exerciseProfile); | ||
|
||
// then | ||
assertThat(savedProfile).usingRecursiveComparison() | ||
.ignoringFields("id") | ||
.isEqualTo(exerciseProfile); | ||
} | ||
|
||
@Test | ||
void 회원_운동_정보_프로필이_저장되면_회원_id로_조회_시_존재한다() { | ||
// given | ||
Long memberId = 1L; | ||
ExerciseProfile exerciseProfile = ExerciseProfile.createWith("처음", "주 1회", "근비대", "초보자", memberId); | ||
exerciseProfileJpaRepository.save(exerciseProfile); | ||
|
||
// when | ||
boolean find = exerciseProfileJpaRepository.existsByMemberId(memberId); | ||
|
||
// then | ||
assertThat(find).isTrue(); | ||
} | ||
} |