diff --git a/src/main/java/aromanticcat/umcproject/repository/MemberRepository.java b/src/main/java/aromanticcat/umcproject/repository/MemberRepository.java new file mode 100644 index 0000000..a3a099e --- /dev/null +++ b/src/main/java/aromanticcat/umcproject/repository/MemberRepository.java @@ -0,0 +1,7 @@ +package aromanticcat.umcproject.repository; + +import aromanticcat.umcproject.entity.Member; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface MemberRepository extends JpaRepository { +} diff --git a/src/main/java/aromanticcat/umcproject/repository/NangmanLetterRepository.java b/src/main/java/aromanticcat/umcproject/repository/NangmanLetterRepository.java new file mode 100644 index 0000000..79a52e5 --- /dev/null +++ b/src/main/java/aromanticcat/umcproject/repository/NangmanLetterRepository.java @@ -0,0 +1,7 @@ +package aromanticcat.umcproject.repository; + +import aromanticcat.umcproject.entity.NangmanLetter; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface NangmanLetterRepository extends JpaRepository { +} diff --git a/src/test/java/aromanticcat/umcproject/repository/NangmanLetterTests.java b/src/test/java/aromanticcat/umcproject/repository/NangmanLetterTests.java new file mode 100644 index 0000000..414e229 --- /dev/null +++ b/src/test/java/aromanticcat/umcproject/repository/NangmanLetterTests.java @@ -0,0 +1,39 @@ +package aromanticcat.umcproject.repository; + +import aromanticcat.umcproject.entity.Member; +import aromanticcat.umcproject.entity.NangmanLetter; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +public class NangmanLetterTests { + + @Autowired + private NangmanLetterRepository nangmanLetterRepository; + + @Autowired + private MemberRepository memberRepository; + + + @Test + public void testInsertNangmanLetter(){ + + Member member1 = Member.builder() + .email("test@email.com") + .nickname("member1") + .coin(0) + .build(); + memberRepository.save(member1); + + NangmanLetter nangmanLetter = NangmanLetter.builder() + .is_public(false) + .sender_nickname("낭만적인 고양이") + .content("제 고민을 들어주세요") + .member(member1) + .build(); + NangmanLetter result = nangmanLetterRepository.save(nangmanLetter); + + System.out.println(result); + } +}