Skip to content

Commit

Permalink
[feature/Inhabas#234] 충돌 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
skytin1004 committed Feb 21, 2024
1 parent 7b2f41d commit 6950a35
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 182 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import com.inhabas.api.domain.board.domain.BaseBoard;
import com.inhabas.api.domain.board.domain.NormalBoard;
import com.inhabas.api.domain.board.domain.valueObject.Content;
import com.inhabas.api.domain.board.domain.valueObject.Title;
import com.inhabas.api.domain.contest.domain.valueObject.Association;
Expand All @@ -35,7 +35,7 @@
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@EntityListeners(AuditingEntityListener.class)
public class ContestBoard extends BaseBoard {
public class ContestBoard extends NormalBoard {

@Enumerated(EnumType.STRING)
@Column(name = "CONTEST_TYPE", nullable = false)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.inhabas.api.domain.contest.dto;

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

import java.time.LocalDate;

import com.inhabas.api.domain.file.dto.FileDownloadDto;

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

public class ContestBoardDtoTest {

@DisplayName("올바른 공모전을 생성하고 검증한다.")
@Test
public void createContestBoardDto() {

// given
Long id = 1L;
Long contestFieldId = 1L;
String title = "테스트 제목";
String topic = "테스트 주제";
String association = "테스트 협회";
LocalDate dateContestStart = LocalDate.of(2024, 1, 1);
LocalDate dateContestEnd = LocalDate.of(2024, 3, 1);
FileDownloadDto thumbnail = new FileDownloadDto("thumbnail.jpg", "thumbnailUrl");

// when
ContestBoardDto contestBoardDto =
ContestBoardDto.builder()
.id(id)
.contestFieldId(contestFieldId)
.title(title)
.topic(topic)
.association(association)
.dateContestStart(dateContestStart)
.dateContestEnd(dateContestEnd)
.thumbnail(thumbnail)
.build();

// then
assertThat(contestBoardDto.getId()).isEqualTo(id);
assertThat(contestBoardDto.getContestFieldId()).isEqualTo(contestFieldId);
assertThat(contestBoardDto.getTitle()).isEqualTo(title);
assertThat(contestBoardDto.getTopic()).isEqualTo(topic);
assertThat(contestBoardDto.getAssociation()).isEqualTo(association);
assertThat(contestBoardDto.getDateContestStart()).isEqualTo(dateContestStart);
assertThat(contestBoardDto.getDateContestEnd()).isEqualTo(dateContestEnd);
assertThat(contestBoardDto.getThumbnail()).isEqualTo(thumbnail);

long expectedDDay = LocalDate.now().until(dateContestEnd, java.time.temporal.ChronoUnit.DAYS);
assertThat(contestBoardDto.getDDay()).as("D-day가 일치하지 않습니다.").isEqualTo(expectedDDay);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -111,30 +111,30 @@ public void deleteContestBoard() {
// then(contestBoardRepository).should(times(1)).deleteById(any());
}

@DisplayName("공모전 게시글을 수정한다.")
@Test
public void updateContestBoard() {
// //given
// StudentId StudentId = new StudentId("12201863");
// ContestBoard expectedContestBoard =
// new ContestBoard("title", "content", "association", "topic",
// LocalDate.of(2022, 1, 1), LocalDate.of(2022, 1, 26))
// .writtenBy(StudentId);
//
// given(contestBoardRepository.save(any())).willReturn(expectedContestBoard);
//
// given(contestBoardRepository.findById(any())).willReturn(Optional.of(expectedContestBoard));
//
// UpdateContestBoardDto updateContestBoardDto = new UpdateContestBoardDto(1, "수정된 제목",
// "수정된 내용", "수정된 협회기관명", "수정된 공모전 주제", LocalDate.of(2022, 1, 1),
// LocalDate.of(2022, 1, 26));
//
// // when
// contestBoardService.update(StudentId, updateContestBoardDto);
//
// // then
// then(contestBoardRepository).should(times(1)).save(any());
}
// @DisplayName("공모전 게시글을 수정한다.")
// @Test
// public void updateContestBoard() {
// //given
// StudentId StudentId = new StudentId("12201863");
// ContestBoard expectedContestBoard =
// new ContestBoard("title", "content", "association", "topic",
// LocalDate.of(2022, 1, 1), LocalDate.of(2022, 1, 26))
// .writtenBy(StudentId);
//
// given(contestBoardRepository.save(any())).willReturn(expectedContestBoard);
//
// given(contestBoardRepository.findById(any())).willReturn(Optional.of(expectedContestBoard));
//
// UpdateContestBoardDto updateContestBoardDto = new UpdateContestBoardDto(1, "수정된 제목",
// "수정된 내용", "수정된 협회기관명", "수정된 공모전 주제", LocalDate.of(2022, 1, 1),
// LocalDate.of(2022, 1, 26));
//
// // when
// contestBoardService.update(StudentId, updateContestBoardDto);
//
// // then
// then(contestBoardRepository).should(times(1)).save(any());
// }

@DisplayName("작성자가 아니면 수정할 수 없다.")
@Test
Expand Down

0 comments on commit 6950a35

Please sign in to comment.