Skip to content

Commit

Permalink
test: 추가 테스트 코드 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
ymkim97 committed Oct 31, 2023
1 parent a35ce88 commit c299ac3
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 2 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ jacocoTestReport {
"**/*Mapper*",
"**/*ErrorMessage*",
"**/*DynamicQuery*",
"**/*BaseTimeEntity*",
] + Qdomains)
})
)
Expand Down
41 changes: 41 additions & 0 deletions src/test/java/com/moabam/api/domain/entity/CertificationTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.moabam.api.domain.entity;

import static org.assertj.core.api.Assertions.*;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import com.moabam.api.domain.entity.enums.RoomType;

class CertificationTest {

String content = "물 마시기";
String image = "https://s3.testtest";

@DisplayName("Certification 생성 성공")
@Test
void create_certification_success() {
Room room = Room.builder()
.title("앵윤이의 방")
.roomType(RoomType.MORNING)
.certifyTime(10)
.maxUserCount(9)
.build();

Routine routine = Routine.builder()
.room(room)
.content(content)
.build();

assertThatNoException().isThrownBy(() -> {
Certification certification = Certification.builder()
.routine(routine)
.memberId(1L)
.image(image).build();

assertThat(certification.getImage()).isEqualTo(image);
assertThat(certification.getMemberId()).isEqualTo(1L);
assertThat(certification.getRoutine()).isEqualTo(routine);
});
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.moabam.api.domain;
package com.moabam.api.domain.entity;

import static org.assertj.core.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import com.moabam.api.domain.entity.Member;
import com.moabam.api.domain.entity.enums.Role;
import com.moabam.global.common.util.BaseImageUrl;

Expand Down
7 changes: 7 additions & 0 deletions src/test/java/com/moabam/api/domain/entity/RoomTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ void create_room_without_password_success() {

// then
assertThat(room.getPassword()).isNull();
assertThat(room.getRoomImage()).isEqualTo("'temptemp'");
assertThat(room.getRoomType()).isEqualTo(RoomType.MORNING);
assertThat(room.getCertifyTime()).isEqualTo(10);
assertThat(room.getMaxUserCount()).isEqualTo(9);
assertThat(room.getLevel()).isZero();
assertThat(room.getCurrentUserCount()).isEqualTo(1);
assertThat(room.getAnnouncement()).isNull();
}

@DisplayName("비밀번호 설정 후 방 생성 성공")
Expand Down

0 comments on commit c299ac3

Please sign in to comment.