aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/test/java/com/juick/tests/util
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-01-12 14:59:11 +0300
committerGravatar Vitaly Takmazov2017-01-12 14:59:11 +0300
commit0c1ef3ab4f352445df3c1ebf87fe9eac2f78df41 (patch)
tree67248eabf7ca63cdfe5beddad090a33c86b51973 /juick-server/src/test/java/com/juick/tests/util
parent14940bf9bf63b1ca8d7d09fde37be52c9ae94ca8 (diff)
tests refactoring
Diffstat (limited to 'juick-server/src/test/java/com/juick/tests/util')
-rw-r--r--juick-server/src/test/java/com/juick/tests/util/MockUtils.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/juick-server/src/test/java/com/juick/tests/util/MockUtils.java b/juick-server/src/test/java/com/juick/tests/util/MockUtils.java
new file mode 100644
index 00000000..c67b26ef
--- /dev/null
+++ b/juick-server/src/test/java/com/juick/tests/util/MockUtils.java
@@ -0,0 +1,33 @@
+package com.juick.tests.util;
+
+import com.juick.Message;
+import com.juick.User;
+import org.apache.commons.lang3.RandomStringUtils;
+
+import java.util.Date;
+
+/**
+ * Created by vitalyster on 12.01.2017.
+ */
+public class MockUtils {
+ public static Message mockMessage(Integer mid, final User user, final String messageText) {
+ Message msg = new Message();
+
+ msg.setMid(mid);
+ msg.setUser(user);
+ msg.setText(messageText == null ? RandomStringUtils.randomAlphanumeric(24) : messageText);
+ msg.setDate(new Date());
+ return msg;
+ }
+
+ public static User mockUser(final int uid, final String name, final String password) {
+ User user = new User();
+
+ user.setName(name);
+ user.setUid(uid);
+ user.setCredentials(password);
+ user.setBanned(false);
+
+ return user;
+ }
+}