• 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_YONAsourcetestplayRepositoryCommitTest.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
hooks
Source Code Upload
02-04
CommitTest.java
Source Code Upload
02-04
FileDiffTest.java
Source Code Upload
02-04
GitRepositoryTest.java
Source Code Upload
02-04
RepositoryServiceTest.java
Source Code Upload
02-04
Nell 02-04 2600fe6 Source Code Upload UNIX
Raw Open in browser Change history
/** * Yobi, Project Hosting SW * * Copyright 2013 NAVER Corp. * http://yobi.io * * @Author kjkmadness * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package playRepository; import static org.fest.assertions.Assertions.assertThat; import java.util.Date; import java.util.Set; import java.util.TimeZone; import models.*; import org.junit.*; public class CommitTest extends ModelTest<Commit> { @Before public void before() { for(Watch watch : Watch.find.all()) { watch.delete(); } for(Unwatch unwatch : Unwatch.find.all()) { unwatch.delete(); } } @Test public void getWatchers_no_watchers() { // Given Commit commit = createTestCommit("test", User.anonymous); // When Set<User> watchers = commit.getWatchers(getTestProject()); // Then assertThat(watchers).isEmpty(); } @Test public void getWatchers_with_author() { // Given User author = getTestUser(); Commit commit = createTestCommit("test", author); // When Set<User> watchers = commit.getWatchers(getTestProject()); // Then assertThat(watchers).containsOnly(author); } @Test public void getWatchers_with_commet_git() { // Given User author = getTestUser(2L); String commitId = "test"; Commit commit = createTestCommit(commitId, author); User commentUser = getTestUser(3L); Project project = getTestProject(); ReviewComment comment = new ReviewComment(); CodeCommentThread thread = new CodeCommentThread(); thread.project = project; thread.commitId = commitId; comment.thread = thread; comment.author = new UserIdent(commentUser); comment.save(); // When Set<User> watchers = commit.getWatchers(project); // Then assertThat(watchers).containsOnly(author, commentUser); comment.delete(); } @Test public void getWatchers_with_comment_svn() { // Given User author = getTestUser(4L); String commitId = "1"; Commit commit = createTestCommit(commitId, author); User commentUser = getTestUser(3L); Project project = Project.find.byId(3l); CommitComment comment = new CommitComment(); comment.project = project; comment.commitId = commitId; comment.setAuthor(commentUser); comment.save(); // When Set<User> watchers = commit.getWatchers(project); // Then assertThat(watchers).containsOnly(author, commentUser); } @Test public void getWatchers_with_project_watcher() { // Given User author = getTestUser(2L); Commit commit = createTestCommit("test", author); User projectWatcher = getTestUser(3L); Project project = getTestProject(); projectWatcher.addWatching(project); // When Set<User> watchers = commit.getWatchers(project); // Then assertThat(watchers).containsOnly(author, projectWatcher); } @Test public void getWatchers_explicitly_watch_unwatch() { // Given User author = getTestUser(2L); Commit commit = createTestCommit("test", author); Project project = getTestProject(); User watcher = getTestUser(3L); Watch.watch(watcher, commit.asResource(project)); User unwatcher = getTestUser(4L); unwatcher.addWatching(project); Watch.unwatch(unwatcher, commit.asResource(project)); // When Set<User> watchers = commit.getWatchers(project); // Then assertThat(watchers).containsOnly(author, watcher); } @Test public void getWatchers_private_project() { // Given User author = getTestUser(1L); Commit commit = createTestCommit("test", author); Project project = getTestProject(5L); User watcher = getTestUser(2L); Watch.watch(watcher, commit.asResource(project)); // When Set<User> watchers = commit.getWatchers(project); // Then assertThat(watchers).containsOnly(author); } private Commit createTestCommit(final String id, final User author) { return new Commit() { @Override public String getShortMessage() { return null; } @Override public String getShortId() { return null; } @Override public int getParentCount() { return 0; } @Override public String getMessage() { return null; } @Override public String getId() { return id; } @Override public TimeZone getCommitterTimezone() { return null; } @Override public String getCommitterName() { return null; } @Override public String getCommitterEmail() { return null; } @Override public Date getCommitterDate() { return null; } @Override public TimeZone getAuthorTimezone() { return null; } @Override public String getAuthorName() { return null; } @Override public String getAuthorEmail() { return null; } @Override public Date getAuthorDate() { return null; } @Override public User getAuthor() { return author; } }; } }

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

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