Skip to content

Commit

Permalink
[test]h2 세팅 테스트 (#3)
Browse files Browse the repository at this point in the history
h2 설정 확인을 위한 테스트 작성
  • Loading branch information
YeaChan05 authored and hwan2-99 committed Feb 6, 2024
1 parent e0048ef commit 7059ad7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/java/org/kakaoshare/backend/TestEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.kakaoshare.backend;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;

@Entity
public class TestEntity {
@Id
@GeneratedValue
@Column(name="test-entity"+"_id")
private Long id;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.kakaoshare.backend;

import org.springframework.data.jpa.repository.JpaRepository;

public interface TestEntityRepository extends JpaRepository<TestEntity, Long> {
}
14 changes: 14 additions & 0 deletions src/test/java/org/kakaoshare/backend/TestComponentTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.*;
@SpringBootTest
@ActiveProfiles(value="test")
class TestComponentTest {
@Autowired
TestComponent testComponent;
@Autowired
TestEntityRepository testEntityRepository;
@Test
void test_ci() {
// given
Expand All @@ -21,4 +25,14 @@ void test_ci() {

}

@Test
void test_h2() {
// given
testEntityRepository.save(new TestEntity());
// when
assertThat(testEntityRepository.findAll().size()).isEqualTo(1);
// then

}

}

0 comments on commit 7059ad7

Please sign in to comment.