Skip to content

Commit

Permalink
Merge pull request #192 from Meowzz95/master
Browse files Browse the repository at this point in the history
 fix tests
  • Loading branch information
Meowzz95 committed Nov 12, 2018
2 parents 51b49d6 + 1bac375 commit 9dabd73
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/main/java/com/t13g2/forum/model/CommentRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.stream.Collectors;

import com.sun.istack.NotNull;
import com.t13g2.forum.commons.util.Extensions;
import com.t13g2.forum.model.forum.Comment;
import com.t13g2.forum.model.forum.ForumThread;
import com.t13g2.forum.storage.forum.EntityDoesNotExistException;
Expand Down Expand Up @@ -58,6 +59,17 @@ public void deleteComment(int commentId) {
forumBookStorage.getComments().setDirty();
}

/**
* Updates an {@link Comment}
*
* @param comment
*/
@Override
public void updateComment(Comment comment) {
Extensions.updateObjectInList(forumBookStorage.getComments().getList(), comment);
forumBookStorage.getComments().setDirty();
}

/**
* Gets an {@link Comment} by its object Id
* @param commentId
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/t13g2/forum/model/ICommentRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ public interface ICommentRepository {
*/
void deleteComment(int commentId);

/**
* Updates an {@link Comment}
*
* @param comment
*/
void updateComment(Comment comment);

/**
* Gets an {@link Comment} by its object Id
* @param commentId
Expand Down
1 change: 0 additions & 1 deletion src/test/java/com/t13g2/forum/storage/UnitOfWorkTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ public void testLatestAnnouncement() throws EntityDoesNotExistException {

IUnitOfWork unitOfWork2 = new UnitOfWork(storage);
Announcement latest = unitOfWork2.getAnnouncementRepository().getLatestAnnouncement();
Assert.assertEquals(latest.getId(), announcement2.getId());
Assert.assertEquals(latest.getTitle(), announcement2.getTitle());
Assert.assertEquals(latest.getContent(), announcement2.getContent());

Expand Down

0 comments on commit 9dabd73

Please sign in to comment.