Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- VLAN
- Oracle
- sql
- 이것이 자바다
- 버추얼머신
- 원형그래프
- 네트워크관리사
- Java
- 리눅스
- Cisco
- autoset
- NCS
- javaee
- w3school
- 라우터
- rinux
- 데이터베이스
- cisco packet
- 정처기필기
- jsp
- 네트워크
- 오라클
- php
- html
- 자바
- 정보처리기사
- jsp연결
- ospf
- ciscopacket
- 참조타입
Archives
- Today
- Total
기록해! 정리해!
JPA - Board(Junit-1) 본문
- TestBoardRepo1

package com.rubypaper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import com.rubypaper.board.Board;
import com.rubypaper.board.BoardRepository;
@RunWith(SpringRunner.class)
@SpringBootTest
public class TestBoardRepo1 {
@Autowired
private BoardRepository BoardRepo;
@Test
public void testInsert() {
for (Long i = 1L; i<= 10; i++) {
Board board= new Board();
board.setTitle("게시판 제목" + i);
board.setPassword("1234");
board.setWriter("옥수수");
board.setContent("게시판 내용" + i);
BoardRepo.save(board);
}
}
}
>> 하면 Junit4가 생길텐데 버전 업을 해줘 Junit5로 해준다

>> TestBoardRepo1 우클릭해서 Junit으로 실행하면
에러없이 잘 들어감.
>> 오라클에서 확인하기

지금 cnt에 디폴트값1이 안들어와서 수정해보겠음
엔터티 Board 수정
디폴트설정하려면 꼭 insertable=false하기 !
'SpringBoot' 카테고리의 다른 글
JPAJarTymeleaf-1 (board) (0) | 2022.10.18 |
---|---|
JPA - Board(Junit -2) (0) | 2022.10.17 |
JPAJarTymeleaf - Board (0) | 2022.10.17 |
JPA 스타트 (테이블 생성 후 오라클에서 확인하기) (0) | 2022.10.17 |
Thymeleaf - maven install (0) | 2022.10.17 |
Comments