aboutsummaryrefslogtreecommitdiff
path: root/juick-server-jdbc/src/test/java/com/juick/tests
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-06-29 14:03:04 +0300
committerGravatar Vitaly Takmazov2017-06-29 14:03:04 +0300
commit02723131139806c761539a42a5fa80b68ecadee8 (patch)
treeca66f22993908758385f708eb2da4e4aeb20510a /juick-server-jdbc/src/test/java/com/juick/tests
parent4cc4b08f4377b7db697abdb533c625da608eb3d3 (diff)
project structure: split server into jdbc + web
Diffstat (limited to 'juick-server-jdbc/src/test/java/com/juick/tests')
-rw-r--r--juick-server-jdbc/src/test/java/com/juick/tests/util/MockUtils.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/juick-server-jdbc/src/test/java/com/juick/tests/util/MockUtils.java b/juick-server-jdbc/src/test/java/com/juick/tests/util/MockUtils.java
new file mode 100644
index 00000000..5344dd23
--- /dev/null
+++ b/juick-server-jdbc/src/test/java/com/juick/tests/util/MockUtils.java
@@ -0,0 +1,34 @@
+package com.juick.tests.util;
+
+import com.juick.Message;
+import com.juick.User;
+import org.apache.commons.text.RandomStringGenerator;
+
+import java.util.Date;
+
+/**
+ * Created by vitalyster on 12.01.2017.
+ */
+public class MockUtils {
+ final static RandomStringGenerator generator = new RandomStringGenerator.Builder().withinRange('a', 'z').build();
+ 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 ? generator.generate(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;
+ }
+}