mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-07-19 19:16:11 +00:00
Fix NotificationServiceTest constructor
This commit is contained in:
@@ -3,6 +3,7 @@ package com.openisle.service;
|
|||||||
import com.openisle.model.*;
|
import com.openisle.model.*;
|
||||||
import com.openisle.repository.NotificationRepository;
|
import com.openisle.repository.NotificationRepository;
|
||||||
import com.openisle.repository.UserRepository;
|
import com.openisle.repository.UserRepository;
|
||||||
|
import com.openisle.repository.ReactionRepository;
|
||||||
import com.openisle.service.PushNotificationService;
|
import com.openisle.service.PushNotificationService;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
@@ -19,9 +20,10 @@ class NotificationServiceTest {
|
|||||||
void markReadUpdatesOnlyOwnedNotifications() {
|
void markReadUpdatesOnlyOwnedNotifications() {
|
||||||
NotificationRepository nRepo = mock(NotificationRepository.class);
|
NotificationRepository nRepo = mock(NotificationRepository.class);
|
||||||
UserRepository uRepo = mock(UserRepository.class);
|
UserRepository uRepo = mock(UserRepository.class);
|
||||||
|
ReactionRepository rRepo = mock(ReactionRepository.class);
|
||||||
EmailSender email = mock(EmailSender.class);
|
EmailSender email = mock(EmailSender.class);
|
||||||
PushNotificationService push = mock(PushNotificationService.class);
|
PushNotificationService push = mock(PushNotificationService.class);
|
||||||
NotificationService service = new NotificationService(nRepo, uRepo, email, push);
|
NotificationService service = new NotificationService(nRepo, uRepo, email, push, rRepo);
|
||||||
org.springframework.test.util.ReflectionTestUtils.setField(service, "websiteUrl", "https://ex.com");
|
org.springframework.test.util.ReflectionTestUtils.setField(service, "websiteUrl", "https://ex.com");
|
||||||
|
|
||||||
User user = new User();
|
User user = new User();
|
||||||
@@ -48,9 +50,10 @@ class NotificationServiceTest {
|
|||||||
void listNotificationsWithoutFilter() {
|
void listNotificationsWithoutFilter() {
|
||||||
NotificationRepository nRepo = mock(NotificationRepository.class);
|
NotificationRepository nRepo = mock(NotificationRepository.class);
|
||||||
UserRepository uRepo = mock(UserRepository.class);
|
UserRepository uRepo = mock(UserRepository.class);
|
||||||
|
ReactionRepository rRepo = mock(ReactionRepository.class);
|
||||||
EmailSender email = mock(EmailSender.class);
|
EmailSender email = mock(EmailSender.class);
|
||||||
PushNotificationService push = mock(PushNotificationService.class);
|
PushNotificationService push = mock(PushNotificationService.class);
|
||||||
NotificationService service = new NotificationService(nRepo, uRepo, email, push);
|
NotificationService service = new NotificationService(nRepo, uRepo, email, push, rRepo);
|
||||||
org.springframework.test.util.ReflectionTestUtils.setField(service, "websiteUrl", "https://ex.com");
|
org.springframework.test.util.ReflectionTestUtils.setField(service, "websiteUrl", "https://ex.com");
|
||||||
|
|
||||||
User user = new User();
|
User user = new User();
|
||||||
@@ -71,9 +74,10 @@ class NotificationServiceTest {
|
|||||||
void countUnreadReturnsRepositoryValue() {
|
void countUnreadReturnsRepositoryValue() {
|
||||||
NotificationRepository nRepo = mock(NotificationRepository.class);
|
NotificationRepository nRepo = mock(NotificationRepository.class);
|
||||||
UserRepository uRepo = mock(UserRepository.class);
|
UserRepository uRepo = mock(UserRepository.class);
|
||||||
|
ReactionRepository rRepo = mock(ReactionRepository.class);
|
||||||
EmailSender email = mock(EmailSender.class);
|
EmailSender email = mock(EmailSender.class);
|
||||||
PushNotificationService push = mock(PushNotificationService.class);
|
PushNotificationService push = mock(PushNotificationService.class);
|
||||||
NotificationService service = new NotificationService(nRepo, uRepo, email, push);
|
NotificationService service = new NotificationService(nRepo, uRepo, email, push, rRepo);
|
||||||
org.springframework.test.util.ReflectionTestUtils.setField(service, "websiteUrl", "https://ex.com");
|
org.springframework.test.util.ReflectionTestUtils.setField(service, "websiteUrl", "https://ex.com");
|
||||||
|
|
||||||
User user = new User();
|
User user = new User();
|
||||||
@@ -92,9 +96,10 @@ class NotificationServiceTest {
|
|||||||
void createRegisterRequestNotificationsDeletesOldOnes() {
|
void createRegisterRequestNotificationsDeletesOldOnes() {
|
||||||
NotificationRepository nRepo = mock(NotificationRepository.class);
|
NotificationRepository nRepo = mock(NotificationRepository.class);
|
||||||
UserRepository uRepo = mock(UserRepository.class);
|
UserRepository uRepo = mock(UserRepository.class);
|
||||||
|
ReactionRepository rRepo = mock(ReactionRepository.class);
|
||||||
EmailSender email = mock(EmailSender.class);
|
EmailSender email = mock(EmailSender.class);
|
||||||
PushNotificationService push = mock(PushNotificationService.class);
|
PushNotificationService push = mock(PushNotificationService.class);
|
||||||
NotificationService service = new NotificationService(nRepo, uRepo, email, push);
|
NotificationService service = new NotificationService(nRepo, uRepo, email, push, rRepo);
|
||||||
org.springframework.test.util.ReflectionTestUtils.setField(service, "websiteUrl", "https://ex.com");
|
org.springframework.test.util.ReflectionTestUtils.setField(service, "websiteUrl", "https://ex.com");
|
||||||
|
|
||||||
User admin = new User();
|
User admin = new User();
|
||||||
@@ -114,9 +119,10 @@ class NotificationServiceTest {
|
|||||||
void createActivityRedeemNotificationsDeletesOldOnes() {
|
void createActivityRedeemNotificationsDeletesOldOnes() {
|
||||||
NotificationRepository nRepo = mock(NotificationRepository.class);
|
NotificationRepository nRepo = mock(NotificationRepository.class);
|
||||||
UserRepository uRepo = mock(UserRepository.class);
|
UserRepository uRepo = mock(UserRepository.class);
|
||||||
|
ReactionRepository rRepo = mock(ReactionRepository.class);
|
||||||
EmailSender email = mock(EmailSender.class);
|
EmailSender email = mock(EmailSender.class);
|
||||||
PushNotificationService push = mock(PushNotificationService.class);
|
PushNotificationService push = mock(PushNotificationService.class);
|
||||||
NotificationService service = new NotificationService(nRepo, uRepo, email, push);
|
NotificationService service = new NotificationService(nRepo, uRepo, email, push, rRepo);
|
||||||
org.springframework.test.util.ReflectionTestUtils.setField(service, "websiteUrl", "https://ex.com");
|
org.springframework.test.util.ReflectionTestUtils.setField(service, "websiteUrl", "https://ex.com");
|
||||||
|
|
||||||
User admin = new User();
|
User admin = new User();
|
||||||
@@ -136,9 +142,10 @@ class NotificationServiceTest {
|
|||||||
void createNotificationSendsEmailForCommentReply() {
|
void createNotificationSendsEmailForCommentReply() {
|
||||||
NotificationRepository nRepo = mock(NotificationRepository.class);
|
NotificationRepository nRepo = mock(NotificationRepository.class);
|
||||||
UserRepository uRepo = mock(UserRepository.class);
|
UserRepository uRepo = mock(UserRepository.class);
|
||||||
|
ReactionRepository rRepo = mock(ReactionRepository.class);
|
||||||
EmailSender email = mock(EmailSender.class);
|
EmailSender email = mock(EmailSender.class);
|
||||||
PushNotificationService push = mock(PushNotificationService.class);
|
PushNotificationService push = mock(PushNotificationService.class);
|
||||||
NotificationService service = new NotificationService(nRepo, uRepo, email, push);
|
NotificationService service = new NotificationService(nRepo, uRepo, email, push, rRepo);
|
||||||
org.springframework.test.util.ReflectionTestUtils.setField(service, "websiteUrl", "https://ex.com");
|
org.springframework.test.util.ReflectionTestUtils.setField(service, "websiteUrl", "https://ex.com");
|
||||||
|
|
||||||
User user = new User();
|
User user = new User();
|
||||||
|
|||||||
Reference in New Issue
Block a user