① BoardRepositoryTest ( insert )
페이지 정보
작성자 관리자 작성일 24-06-27 15:01 조회 64 댓글 0본문
package web.repository;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.IntStream;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import jakarta.transaction.Transactional;
import lombok.extern.log4j.Log4j2;
import web.domain.Board;
import web.dto.BoardListReplyCountDTO;
@SpringBootTest
@Log4j2
public class BoardRepositoryTest {
@Autowired
private BoardRepository boardRepository;
@Test
public void testInsertWithImages() {
Board board = Board.builder()
.title("이미지 테스트")
.content("첨부 내용")
.writer("1111")
.build();
for(int i=0; i<3; i++) {
board.addImage(UUID.randomUUID().toString(), "file"+i+".jpg");
}
boardRepository.save(board);
}
}
댓글목록 0
등록된 댓글이 없습니다.