diff options
author | Vitaly Takmazov | 2018-11-12 12:10:44 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-11-12 12:10:49 +0300 |
commit | f7eeb5c5d40648bf1e0f76dab4e68c96995872c7 (patch) | |
tree | 79942d5fad59ca791e929b51eeb680dc55700165 /src/test/java | |
parent | d158b85517189afd43532a752e0093394c135f0f (diff) |
api: message entities
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/com/juick/MessageTest.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/java/com/juick/MessageTest.java b/src/test/java/com/juick/MessageTest.java index 6197f861..f76054cd 100644 --- a/src/test/java/com/juick/MessageTest.java +++ b/src/test/java/com/juick/MessageTest.java @@ -17,12 +17,17 @@ package com.juick; +import com.juick.model.Entity; +import com.juick.test.util.MockUtils; import com.juick.util.MessageUtils; import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.StringUtils; import org.junit.Test; +import java.util.ArrayList; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; @@ -180,4 +185,11 @@ public class MessageTest { msg.setText("And dick is @ugnich@jabber.zp.ua"); assertThat(MessageUtils.getGlobalMentions(msg).size(), is(1)); } + @Test + public void entitiesTest() { + String msg = "http://google.com - there will @ugnich ask questions from #4321, then go to http://stackoverflow.com"; + Message testMessage = MockUtils.mockMessage(514, MockUtils.mockUser(5432, "fmap", "secret"), msg); + List<Entity> entities = MessageUtils.getEntities(testMessage); + assertThat(entities.size(), is(4)); + } } |