File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .example .fiurinee .integration .recommendComment ;
2
+
3
+
4
+ import com .example .fiurinee .domain .member .entity .Member ;
5
+ import com .example .fiurinee .domain .recommendComment .entity .RecommendComment ;
6
+ import com .example .fiurinee .domain .recommendComment .repository .RecommendCommentRepository ;
7
+ import com .example .fiurinee .domain .recommendComment .service .RecommendCommentService ;
8
+ import com .example .fiurinee .domain .recommendFlower .entity .RecommendFlower ;
9
+ import org .junit .jupiter .api .BeforeEach ;
10
+ import org .junit .jupiter .api .Test ;
11
+ import org .mockito .InjectMocks ;
12
+ import org .mockito .Mock ;
13
+ import org .mockito .MockitoAnnotations ;
14
+
15
+ import static org .mockito .Mockito .*;
16
+
17
+ public class RecommendCommentServiceTest {
18
+
19
+ @ Mock
20
+ private RecommendCommentRepository recommendCommentRepository ;
21
+
22
+ @ InjectMocks
23
+ private RecommendCommentService recommendCommentService ;
24
+
25
+ @ BeforeEach
26
+ void setUp () {
27
+ MockitoAnnotations .openMocks (this );
28
+ }
29
+
30
+ @ Test
31
+ void testSaveRecommendComment () {
32
+ // Given
33
+ Member member = Member .builder ()
34
+ .build ();
35
+
36
+ RecommendComment recommendComment = RecommendComment .builder ()
37
+ .recommendCommentId (1L )
38
+ .member (member )
39
+ .content ("내 이름은 문희, 탐정이죠" )
40
+ .prefer (true )
41
+ .build ();
42
+
43
+ // When
44
+ recommendCommentService .saveRecommendComment (recommendComment );
45
+
46
+ // Then
47
+ verify (recommendCommentRepository , times (1 )).save (recommendComment );
48
+ }
49
+
50
+ }
You can’t perform that action at this time.
0 commit comments