-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
94 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
sns_service/src/main/kotlin/joryu/sns_service/feed/repository/FeedLikeRepository.kt
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
sns_service/src/main/kotlin/joryu/sns_service/feed/repository/FeedRepository.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
sns_service/src/main/kotlin/joryu/sns_service/post/repository/PostLikeRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package joryu.sns_service.post.repository | ||
|
||
import joryu.sns_service.post.entity.PostLike | ||
import org.springframework.data.jpa.repository.JpaRepository | ||
|
||
interface PostLikeRepository : JpaRepository<PostLike, Long> |
6 changes: 6 additions & 0 deletions
6
sns_service/src/main/kotlin/joryu/sns_service/post/repository/PostRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package joryu.sns_service.post.repository | ||
|
||
import joryu.sns_service.post.entity.Post | ||
import org.springframework.data.jpa.repository.JpaRepository | ||
|
||
interface PostRepository : JpaRepository<Post, Long> |
4 changes: 2 additions & 2 deletions
4
...ervice/feed/repository/ShareRepository.kt → ...ervice/post/repository/ShareRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package joryu.sns_service.feed.repository | ||
package joryu.sns_service.post.repository | ||
|
||
import joryu.sns_service.feed.entity.Share | ||
import joryu.sns_service.post.entity.Share | ||
import org.springframework.data.jpa.repository.JpaRepository | ||
|
||
interface ShareRepository : JpaRepository<Share, Long> |
51 changes: 0 additions & 51 deletions
51
sns_service/src/test/kotlin/joryu/sns_service/feed/entity/FeedEntityTest.kt
This file was deleted.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
sns_service/src/test/kotlin/joryu/sns_service/post/entity/PostEntityTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package joryu.sns_service.post.entity | ||
|
||
import jakarta.persistence.EntityManager | ||
import joryu.sns_service.post.repository.PostRepository | ||
import joryu.sns_service.post.entity.Post | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.Test | ||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.boot.test.context.SpringBootTest | ||
import org.springframework.transaction.annotation.Transactional | ||
import java.time.LocalDateTime | ||
|
||
@Transactional | ||
@SpringBootTest | ||
// @Disabled("프로젝트 초기 kotlin entity 테스트용도. springBootTest라 속도가 느려서 disabled.") | ||
class PostEntityTest { | ||
|
||
@Autowired | ||
lateinit var em: EntityManager | ||
|
||
@Autowired | ||
lateinit var postRepository: PostRepository | ||
|
||
@Test | ||
fun `BaseEntity에 createAt, updateAt이 잘 들어가야 한다`() { | ||
val before = LocalDateTime.now() | ||
val postEntity = postRepository.save(Post("123")) | ||
|
||
em.flush() | ||
em.clear() | ||
|
||
val findPostEntity = postRepository.getReferenceById(postEntity.id) | ||
|
||
assertThat(findPostEntity.createAt).isNotNull() | ||
assertThat(findPostEntity.createAt).isAfter(before) | ||
assertThat(findPostEntity.createAt).isBefore(LocalDateTime.now()) | ||
assertThat(findPostEntity.updateAt).isNotNull() | ||
assertThat(findPostEntity.updateAt).isAfter(before) | ||
assertThat(findPostEntity.updateAt).isBefore(LocalDateTime.now()) | ||
} | ||
|
||
@Test | ||
fun `BaseEntity의 Id는 auto increment 되어야 한다`() { | ||
val postEntity1 = postRepository.save(Post("123")) | ||
val postEntity2 = postRepository.save(Post("123")) | ||
val postEntity3 = postRepository.save(Post("123")) | ||
|
||
assertThat(postEntity1.id).isLessThan(postEntity2.id) | ||
assertThat(postEntity2.id).isLessThan(postEntity3.id) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters