Skip to content

Commit

Permalink
test: id로 동영상 조회 메서드
Browse files Browse the repository at this point in the history
  • Loading branch information
SJ70 committed Jul 18, 2024
1 parent 01d25a8 commit e3fd60b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/test/java/com/j9/bestmoments/service/VideoServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import com.j9.bestmoments.repository.VideoRepository;
import com.j9.bestmoments.util.MemberGenerator;
import com.j9.bestmoments.util.VideoGenerator;
import jakarta.persistence.EntityNotFoundException;
import java.util.List;
import java.util.UUID;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -55,4 +57,19 @@ void findAll() {
Assertions.assertTrue(foundVideos.contains(urlPublicVideo));
}

@Test
@Transactional
void findById_Success() {
UUID id = publicVideo.getId();
Video foundVideo = videoService.findById(id);
Assertions.assertEquals(publicVideo, foundVideo);
}

@Test
@Transactional
void findById_Fail() {
UUID id = UUID.randomUUID();
Assertions.assertThrows(EntityNotFoundException.class, () -> videoService.findById(id));
}

}

0 comments on commit e3fd60b

Please sign in to comment.