|
@@ -0,0 +1,34 @@
|
|
|
|
|
+import cn.reghao.tnb.user.app.UserApplication;
|
|
|
|
|
+import cn.reghao.tnb.user.app.db.mapper.UserContactMapper;
|
|
|
|
|
+import cn.reghao.tnb.user.app.model.po.UserContact;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.junit.Test;
|
|
|
|
|
+import org.junit.runner.RunWith;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
|
+import org.springframework.test.context.ActiveProfiles;
|
|
|
|
|
+import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * @author reghao
|
|
|
|
|
+ * @date 2024-11-28 16:40:24
|
|
|
|
|
+ */
|
|
|
|
|
+@Slf4j
|
|
|
|
|
+@ActiveProfiles("dev")
|
|
|
|
|
+@SpringBootTest(classes = UserApplication.class)
|
|
|
|
|
+@RunWith(SpringRunner.class)
|
|
|
|
|
+public class UserContactTest {
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ UserContactMapper userContactMapper;
|
|
|
|
|
+ @Test
|
|
|
|
|
+ public void addContact() {
|
|
|
|
|
+ long userId1 = 10001;
|
|
|
|
|
+ long userId2 = 10002;
|
|
|
|
|
+
|
|
|
|
|
+ UserContact userContact1 = new UserContact(userId1, userId2);
|
|
|
|
|
+ UserContact userContact2 = new UserContact(userId2, userId1);
|
|
|
|
|
+ userContactMapper.saveAll(List.of(userContact1, userContact2));
|
|
|
|
|
+ }
|
|
|
|
|
+}
|