-
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.
Merge pull request #35 from Kusitms-POPTATO-DEV/feat/31-create-backlog
Feat#31: 백로그 생성 기능 구현
- Loading branch information
Showing
7 changed files
with
121 additions
and
1 deletion.
There are no files selected for viewing
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
16 changes: 16 additions & 0 deletions
16
src/main/java/server/poptato/todo/api/request/BacklogCreateRequestDto.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,16 @@ | ||
package server.poptato.todo.api.request; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Builder | ||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class BacklogCreateRequestDto { | ||
@NotBlank(message = "백로그 생성 시 내용은 필수입니다.") | ||
String content; | ||
} |
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
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
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
44 changes: 44 additions & 0 deletions
44
src/test/java/server/poptato/todo/application/BacklogCreateTest.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,44 @@ | ||
package server.poptato.todo.application; | ||
|
||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import server.poptato.todo.domain.entity.Todo; | ||
import server.poptato.todo.domain.repository.TodoRepository; | ||
import server.poptato.todo.domain.value.Type; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@SpringBootTest | ||
public class BacklogCreateTest { | ||
@Autowired | ||
private TodoService todoService; | ||
@Autowired | ||
private TodoRepository todoRepository; | ||
|
||
@DisplayName("백로그 생성 시 할 일의 값들이 기본값으로 설정된다.") | ||
@Test | ||
void 백로그_생성_속성_기본값(){ | ||
//given | ||
Long userId = 1L; | ||
String content = "내용"; | ||
|
||
//when | ||
Long todoId = todoService.generateBacklog(userId,content); | ||
Todo findTodo = todoRepository.findById(todoId).get(); | ||
|
||
//then | ||
assertThat(findTodo.getId()).isNotNull(); | ||
assertThat(findTodo.getTodayOrder()).isNull(); | ||
assertThat(findTodo.getTodayDate()).isNull(); | ||
assertThat(findTodo.getTodayStatus()).isNull(); | ||
assertThat(findTodo.getDeadline()).isNull(); | ||
assertThat(findTodo.getContent()).isEqualTo(content); | ||
assertThat(findTodo.getType()).isEqualTo(Type.BACKLOG); | ||
assertThat(findTodo.getUserId()).isEqualTo(userId); | ||
assertThat(findTodo.isBookmark()).isEqualTo(false); | ||
assertThat(findTodo.getBacklogOrder()).isEqualTo(11L); | ||
assertThat(findTodo.getCompletedDateTime()).isNull(); | ||
} | ||
} |
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