-
Notifications
You must be signed in to change notification settings - Fork 1
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 #31 from SQUAD-D/feature#18/image-update
test code
- Loading branch information
Showing
12 changed files
with
166 additions
and
27 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
global: | ||
scrape_interval: 15s | ||
evaluation_interval: 15s | ||
scrape_configs: | ||
- job_name: prometheus | ||
static_configs: | ||
- targets: [ 'localhost:9090' ] | ||
- job_name: redis-exporter | ||
static_configs: | ||
- targets: [ 'redis-exporter:9121' ] |
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
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
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,39 @@ | ||
package squad.board.dto; | ||
|
||
import org.assertj.core.api.Assertions; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import squad.board.exception.board.BoardException; | ||
|
||
class PaginationTest { | ||
|
||
@Test | ||
@DisplayName("전체 게시글이 100건에 한 페이지당 10건의 게시글을 보여줘야한다면 총 페이지수는 10페이지다.") | ||
public void 총_페이지수연산() { | ||
//given | ||
Pagination pagination = new Pagination(1L, 100L, 10L); | ||
//when | ||
Long totalPageSize = pagination.calculateTotalPages(pagination.getRequestPageSize()); | ||
//then | ||
Assertions.assertThat(totalPageSize).isEqualTo(10); | ||
} | ||
|
||
@Test | ||
@DisplayName("전체 게시글이 101건에 한 페이지당 10건의 게시글을 보여줘야한다면 총 페이지수는 11페이지다.") | ||
public void 총_페이지수연산2() { | ||
//given | ||
Pagination pagination = new Pagination(1L, 101L, 10L); | ||
//when | ||
Long totalPageSize = pagination.calculateTotalPages(pagination.getRequestPageSize()); | ||
//then | ||
Assertions.assertThat(totalPageSize).isEqualTo(11); | ||
} | ||
|
||
@Test | ||
@DisplayName("총 페이지 수를 벗어난 요청은 예외를 발생시킨다.") | ||
public void 페이지_접근_예외() { | ||
// Pagination 은 존재하지않는 페이지 정보 | ||
Assertions.assertThatExceptionOfType(BoardException.class).isThrownBy(() -> new Pagination(5L, 10L, 5L)); | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
src/test/java/squad/board/dto/board/BoardUpdateRequestTest.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,30 @@ | ||
package squad.board.dto.board; | ||
|
||
import org.assertj.core.api.Assertions; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
class BoardUpdateRequestTest { | ||
|
||
@Test | ||
@DisplayName("사용자의 Content에 존재하는 이미지와 DB에 존재하는 이미지가 불일치한다면 추출에 성공한다.") | ||
public void checkDeleteImage() { | ||
//given | ||
String imageUUID1 = UUID.randomUUID().toString(); | ||
String imageUUID2 = UUID.randomUUID().toString(); | ||
String imageUUID3 = UUID.randomUUID().toString(); | ||
String content = "original/" + imageUUID1 + "\"" + "foo/" + "original/" + imageUUID2 + "\"" + "foo"; | ||
List<ImageInfoRequest> imageInfoRequests = new ArrayList<>(); | ||
BoardUpdateRequest boardUpdateRequest = new BoardUpdateRequest("test", content, imageInfoRequests); | ||
List<String> originalUUID = List.of(imageUUID1, imageUUID2, imageUUID3); | ||
//when | ||
List<String> result = boardUpdateRequest.checkDeletedImage(originalUUID); | ||
//then | ||
Assertions.assertThat(result).asList().contains(imageUUID3); | ||
} | ||
|
||
} |