save follow
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package io.spring.infrastructure.user;
|
||||
|
||||
import io.spring.core.user.FollowRelation;
|
||||
import io.spring.core.user.User;
|
||||
import io.spring.core.user.UserRepository;
|
||||
import org.junit.Before;
|
||||
@@ -54,4 +55,14 @@ public class MyBatisUserRepositoryTest {
|
||||
assertThat(optional.get().getUsername(), is(newUsername));
|
||||
assertThat(optional.get().getImage(), is(user.getImage()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_create_new_user_follow_success() throws Exception {
|
||||
User other = new User("other@example.com", "other", "123", "", "");
|
||||
userRepository.save(other);
|
||||
|
||||
FollowRelation followRelation = new FollowRelation(user.getId(), other.getId());
|
||||
userRepository.saveRelation(followRelation);
|
||||
assertThat(userRepository.findRelation(user.getId(), other.getId()).isPresent(), is(true));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user