Skip to content

Commit

Permalink
#87 fix: tokenGenerator 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
rivkode committed Jun 10, 2024
1 parent 6db3df7 commit 9b3be20
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.seoultech.synergybe.domain.common.CustomPasswordEncoder;
import com.seoultech.synergybe.domain.common.generator.IdGenerator;
import com.seoultech.synergybe.domain.common.generator.IdPrefix;
import com.seoultech.synergybe.domain.common.generator.TokenGenerator;
import com.seoultech.synergybe.domain.post.implement.PostManager;
import com.seoultech.synergybe.domain.user.User;
import com.seoultech.synergybe.domain.user.repository.UserRepository;
Expand All @@ -25,6 +26,9 @@ public class PostGeneratorTest {
@Autowired
IdGenerator idGenerator;

@Autowired
TokenGenerator tokenGenerator;

@Autowired
PostManager postManager;

Expand All @@ -34,8 +38,11 @@ public class PostGeneratorTest {

@Test
void generatePost() {
Long userId = idGenerator.generateId();
String userToken = tokenGenerator.generateToken(IdPrefix.USER);

User user = User.builder()
.id("user-id")
.id(userId)
.password("3e4r5t6y6y7u")
.passwordEncoder(passwordEncoder)
.email("email@email.com")
Expand All @@ -49,10 +56,13 @@ void generatePost() {
List<Post> postList = new ArrayList<>();


for (int i = 0; i < 10000; i++) {
String postId = idGenerator.generateId(IdPrefix.POST);
for (int i = 0; i < 10; i++) {
Long postId = idGenerator.generateId();
String postToken = tokenGenerator.generateToken(IdPrefix.POST);

Post post = Post.builder()
.id(postId)
.postToken(postToken)
.user(user)
.title("title")
.content("content")
Expand Down

0 comments on commit 9b3be20

Please sign in to comment.