aboutsummaryrefslogtreecommitdiff
path: root/juick-server-web
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server-web')
-rw-r--r--juick-server-web/build.gradle2
-rw-r--r--juick-server-web/src/main/java/com/juick/tests/util/MockUtils.java34
2 files changed, 35 insertions, 1 deletions
diff --git a/juick-server-web/build.gradle b/juick-server-web/build.gradle
index 3ca262bd..2d1e3167 100644
--- a/juick-server-web/build.gradle
+++ b/juick-server-web/build.gradle
@@ -27,7 +27,7 @@ dependencies {
providedCompile "commons-io:commons-io:2.5"
providedCompile "commons-codec:commons-codec:1.10"
- compile 'com.github.ben-manes.caffeine:caffeine:2.5.2'
+ compile 'com.github.ben-manes.caffeine:caffeine:2.5.3'
compile "org.springframework:spring-webmvc:${rootProject.springFrameworkVersion}"
compile "org.springframework:spring-context-support:${rootProject.springFrameworkVersion}"
diff --git a/juick-server-web/src/main/java/com/juick/tests/util/MockUtils.java b/juick-server-web/src/main/java/com/juick/tests/util/MockUtils.java
new file mode 100644
index 00000000..5344dd23
--- /dev/null
+++ b/juick-server-web/src/main/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;
+ }
+}