• Y
  • List All
  • Feedback
    • This Project
    • All Projects
Profile Account Log out
  • Favorite
  • Project
  • Recent History
Loading...
  • Log in
  • Sign up
kadrians / Testing_for_YONA star
  • Project homeH
  • CodeC
  • IssueI 1
  • Pull requestP
  • Review R
  • MilestoneM
  • BoardB 2
  • Files
  • Commit
  • Branches
Testing_for_YONAsourcetestmodelsNotificationEventTest.java
Download as .zip file
File name
Commit message
Commit date
bin
Yona 1.16.0 Upload
02-04
lib
Yona 1.16.0 Upload
02-04
share/doc/api
Yona 1.16.0 Upload
02-04
source
Source Code Upload
02-04
README.md
Yona 1.16.0 Upload
02-04
File name
Commit message
Commit date
app
Source Code Upload
02-04
conf
Source Code Upload
02-04
docs
Source Code Upload
02-04
lib
Source Code Upload
02-04
project
Source Code Upload
02-04
public
Source Code Upload
02-04
support-script
Source Code Upload
02-04
test
Source Code Upload
02-04
.gitignore
Source Code Upload
02-04
.mailmap
Source Code Upload
02-04
.travis.yml
Source Code Upload
02-04
AUTHORS
Source Code Upload
02-04
LICENSE
Source Code Upload
02-04
NOTICE
Source Code Upload
02-04
README.md
Source Code Upload
02-04
build.sbt
Source Code Upload
02-04
dev.sh
Source Code Upload
02-04
dist.sh
Source Code Upload
02-04
is-alive-bot.sh
Source Code Upload
02-04
minify-js.sh
Source Code Upload
02-04
restart.sh
Source Code Upload
02-04
File name
Commit message
Commit date
actions/support
Source Code Upload
02-04
actors
Source Code Upload
02-04
controllers
Source Code Upload
02-04
mailbox
Source Code Upload
02-04
models
Source Code Upload
02-04
playRepository
Source Code Upload
02-04
support
Source Code Upload
02-04
utils
Source Code Upload
02-04
validation
Source Code Upload
02-04
File name
Commit message
Commit date
support
Source Code Upload
02-04
AttachmentTest.java
Source Code Upload
02-04
CodeCommentThreadTest.java
Source Code Upload
02-04
CommentTest.java
Source Code Upload
02-04
CommentThreadTest.java
Source Code Upload
02-04
CommitCommentTest.java
Source Code Upload
02-04
FileDiffTest.java
Source Code Upload
02-04
IssueTest.java
Source Code Upload
02-04
MilestoneTest.java
Source Code Upload
02-04
ModelTest.java
Source Code Upload
02-04
NotificationEventTest.java
Source Code Upload
02-04
NotificationMailTest.java
Source Code Upload
02-04
OrganizationTest.java
Source Code Upload
02-04
OrganizationUserTest.java
Source Code Upload
02-04
PasswordResetTest.java
Source Code Upload
02-04
PostingTest.java
Source Code Upload
02-04
ProjectTest.java
Source Code Upload
02-04
ProjectUserTest.java
Source Code Upload
02-04
PullRequestEventTest.java
Source Code Upload
02-04
PullRequestTest.java
Source Code Upload
02-04
RecentlyVisitedProjectsTest.java
Source Code Upload
02-04
ReviewCommentTest.java
Source Code Upload
02-04
RoleTest.java
Source Code Upload
02-04
SearchResultTests.java
Source Code Upload
02-04
SearchTests.java
Source Code Upload
02-04
TimelineItemTest.java
Source Code Upload
02-04
UserTest.java
Source Code Upload
02-04
WatchTest.java
Source Code Upload
02-04
Nell 02-04 2600fe6 Source Code Upload UNIX
Raw Open in browser Change history
/** * Yona, 21st Century Project Hosting SW * <p> * Copyright Yona & Yobi Authors & NAVER Corp. & NAVER LABS Corp. * https://yona.io **/ package models; import models.enumeration.EventType; import models.enumeration.ResourceType; import org.junit.Ignore; import org.junit.Test; import play.i18n.Lang; import java.util.HashSet; import java.util.Set; import static org.fest.assertions.Assertions.assertThat; public class NotificationEventTest extends ModelTest<NotificationEvent> { private NotificationEvent getNotificationEvent(ResourceType resourceType) { NotificationEvent event = new NotificationEvent(); event.resourceType = resourceType; event.resourceId = "1"; return event; } @Ignore("Test is ignored as old test with repository dependency") @Test public void add() { // Given NotificationEvent event = getNotificationEvent(ResourceType.ISSUE_POST); // When NotificationEvent.add(event); // Then assertThat(NotificationMail.find.byId(event.notificationMail.id)).isNotNull(); } @Ignore("Test is ignored as old test with repository dependency") @Test public void addTwoTimes() { // Given NotificationEvent event = getNotificationEvent(ResourceType.ISSUE_POST); NotificationEvent.add(event); int numOfMails = NotificationMail.find.all().size(); // When NotificationEvent.add(event); // Then assertThat(NotificationEvent.find.all().size()).isEqualTo(numOfMails); } @Ignore("Test is ignored as old test with repository dependency") @Test public void delete() { // Given NotificationEvent event = getNotificationEvent(ResourceType.ISSUE_POST); NotificationEvent.add(event); // When event.delete(); // Then assertThat(NotificationMail.find.byId(event.notificationMail.id)).isNull(); } @Ignore("Test is ignored as old test with repository dependency") @Test public void add_with_filter() { // Given Issue issue = Issue.finder.byId(1L); Project project = issue.project; User watching_project_off = getTestUser(2L); Watch.watch(watching_project_off, project.asResource()); UserProjectNotification.unwatchExplictly(watching_project_off, project, EventType.ISSUE_ASSIGNEE_CHANGED); User off = getTestUser(3L); UserProjectNotification.unwatchExplictly(off, project, EventType.ISSUE_ASSIGNEE_CHANGED); NotificationEvent event = getNotificationEvent(ResourceType.ISSUE_POST); event.eventType = EventType.ISSUE_ASSIGNEE_CHANGED; event.receivers.add(watching_project_off); event.receivers.add(off); // When NotificationEvent.add(event); // Then assertThat(event.receivers).containsOnly(off); } @Ignore("Test is ignored as old test with repository dependency") @Test public void getNewMentionedUsers1() { // Given String loginId = "doortts"; String oldBody = "I'm @yobi"; String newBody = "I'm @" + loginId; // When Set<User> newMentionedUsers = NotificationEvent.getNewMentionedUsers(oldBody, newBody); // Then User newMentionedUser = User.findByLoginId(loginId); assertThat(newMentionedUsers.size() == 1).isTrue(); assertThat(newMentionedUsers.contains(newMentionedUser)).isTrue(); } @Ignore("Test is ignored as old test with repository dependency") @Test public void getNewMentionedUsers2() { // Given String loginId = "laziel"; String oldBody = "They are @yobi and @doortts"; String newBody = "They are @" + loginId + " and @unknownUserLoginId"; // When Set<User> newMentionedUsers = NotificationEvent.getNewMentionedUsers(oldBody, newBody); // Then User newMentionedUser = User.findByLoginId(loginId); assertThat(newMentionedUsers.size() == 1).isTrue(); assertThat(newMentionedUsers.contains(newMentionedUser)).isTrue(); } @Test public void getMessage_eventTypeIsIssueBodyChangedWithNoParameter_returnString() { // Given NotificationEvent notificationEvent = getNotificationEvent(ResourceType.ISSUE_POST); notificationEvent.eventType = EventType.ISSUE_BODY_CHANGED; notificationEvent.oldValue = "old value"; notificationEvent.newValue = "new value"; // When String result = notificationEvent.getMessage(); // Then assertThat(result.length() > 0).isTrue(); } @Test public void getMessage_eventTypeIsIssueBodyChangedWithParameter_returnString() { // Given NotificationEvent notificationEvent = getNotificationEvent(ResourceType.ISSUE_POST); notificationEvent.eventType = EventType.ISSUE_BODY_CHANGED; notificationEvent.oldValue = "old value"; notificationEvent.newValue = "new value"; // When String result = notificationEvent.getMessage(Lang.defaultLang()); // Then assertThat(result.length() > 0).isTrue(); } @Test public void getPlainMessage_eventTypeIsIssueBodyChangedWithNoParameter_returnString() { // Given NotificationEvent notificationEvent = getNotificationEvent(ResourceType.ISSUE_POST); notificationEvent.eventType = EventType.ISSUE_BODY_CHANGED; notificationEvent.oldValue = "old value"; notificationEvent.newValue = "new value"; // When String result = notificationEvent.getPlainMessage(); // Then assertThat(result.length() > 0).isTrue(); } @Test public void getPlainMessage_eventTypeIsIssueBodyChangedWithParameter_returnString() { // Given NotificationEvent notificationEvent = getNotificationEvent(ResourceType.ISSUE_POST); notificationEvent.eventType = EventType.ISSUE_BODY_CHANGED; notificationEvent.oldValue = "old value"; notificationEvent.newValue = "new value"; // When String result = notificationEvent.getPlainMessage(Lang.defaultLang()); // Then assertThat(result.length() > 0).isTrue(); } }

          
        
    
    
Copyright Yona authors & © NAVER Corp. & NAVER LABS Supported by NAVER CLOUD PLATFORM

or
login with Google Sign in with Google
Reset password | Sign up