@SpringBootTest
public class test {


@Autowired
private QuestionRepositories questionRepositories;


@BeforeEach
void setUp() {
Question q = new Question();
q.setSubject("제목1");
q.setContent("내용1");
q.setCreateDate(LocalDateTime.now());
questionRepositories.save(q);
}

@Test
@DisplayName("게시글수 확인")
void test2(){
List<Question> q1all = this.questionRepositories.findAll();
assertEquals(1, q1all.size());
Question q = q1all.get(0);
assertEquals("제목1",q.getSubject());
}

@Test
@DisplayName("아이디값을 조회")
void test3(){
Optional<Question> oq = this.questionRepositories.findById(1L);
if(oq.isPresent()) {
Question q = oq.get();
assertEquals("제목1",q.getSubject());
}
}

@Test
void testJpa() {
Question q = this.questionRepositories.findBySubject("제목1");
assertEquals(1L, q.getId());
}

}




테스트 할때 값이 50씩 증가해 

@BeforeEach

로 처음에 실행될때 스퀸스 값이 1씩 증가고 50개씩 미리 만들어두는건데 그거 영향받아서 그런거 같은데

맞아? 이걸 방지 하려면 어떻게 해야할까... 아무리 고민해봐도 모르겠음