-
Notifications
You must be signed in to change notification settings - Fork 297
/
Copy pathQuestionTest.java
41 lines (34 loc) · 1.27 KB
/
QuestionTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package nextstep.qna.domain;
import nextstep.users.domain.NsUserTest;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class QuestionTest {
public static final Question Q1 = new Question(NsUserTest.JAVAJIGI, "title1", "contents1");
public static final Question Q2 = new Question(NsUserTest.SANJIGI, "title2", "contents2");
@Test
@DisplayName("로그인한 사용자의 질문 테스트")
public void testIsLoginUserQuestion(){
boolean isLoginUser = Q1.isOwner(NsUserTest.JAVAJIGI);
assertThat(isLoginUser).isTrue();
}
@Test
@DisplayName("로그인한 사용자가 아닌 질문 테스트")
public void testIsNotLoginUserQuestion(){
boolean isLoginUser = Q1.isOwner(NsUserTest.SANJIGI);
assertThat(isLoginUser).isFalse();
}
@Test
@DisplayName("미삭제 상태 질문 테스트")
public void testIsNotDeleted(){
boolean isDeleted = Q1.isDeleted();
assertThat(isDeleted).isFalse();
}
@Test
@DisplayName("삭제 상태 질문 테스트")
public void testIsDeleted(){
Q1.setDeleted(true);
boolean isDeleted = Q1.isDeleted();
assertThat(isDeleted).isTrue();
}
}