Skip to content

Commit

Permalink
Merge pull request #16 from a-romantic-cat/feat/14
Browse files Browse the repository at this point in the history
Feat/14
  • Loading branch information
u-genuine authored Jan 18, 2024
2 parents 3a457d7 + 7a46ed4 commit 99c9758
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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<Member, Long> {
}
Original file line number Diff line number Diff line change
@@ -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<NangmanLetter, Long> {
}
Original file line number Diff line number Diff line change
@@ -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("[email protected]")
.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);
}
}

0 comments on commit 99c9758

Please sign in to comment.