Skip to content

Commit

Permalink
refactor : [code_smell 제거] test public 제거 for문 {} 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
13wjdgk committed Oct 14, 2023
1 parent d9a3ac9 commit 3bf0d97
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,18 @@ public List<FcmMessage> makeAccessFcmMessage() {
NotificationType notificationType = notificationSearchService.findNotificationType("접속");

List<Notification> notifications = new ArrayList<>();
userFcmTokens.forEach(userFcmToken -> {
userFcmTokens.forEach(userFcmToken ->
notifications.add(
notificationMapper.toEntity(userFcmToken.getUser(), title, content, date, notificationType)
);
});
)
);

notificationRepository.saveAll(notifications);

List<FcmMessage> fcmMessages = new ArrayList<>();
fcmTokens.stream().forEach(token -> {
fcmMessages.add(new FcmMessage(token, title, content));
});
fcmTokens.stream().forEach(token ->
fcmMessages.add(new FcmMessage(token, title, content))
);

return fcmMessages;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public class SchedulerService {
@Scheduled(cron = "0 0 18 * * *", zone = "Asia/Seoul")
public void makeNotification() {
List<FcmMessage> fcmMessage = notificationService.makeAccessFcmMessage();
fcmMessage.forEach(message -> {
notificationFluentbitService.sendMessageToFluentbit(message);
});
fcmMessage.forEach(message ->
notificationFluentbitService.sendMessageToFluentbit(message)
);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static com.coniverse.dangjang.fixture.NotificationFixture.*;
import static com.coniverse.dangjang.fixture.UserFixture.*;
import static org.assertj.core.api.AssertionsForClassTypes.*;
import static org.assertj.core.api.Assertions.*;

import java.time.LocalDate;
import java.util.List;
Expand All @@ -24,7 +24,7 @@

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@SpringBootTest
public class NotificationSearchServiceTest {
class NotificationSearchServiceTest {
@Autowired
private NotificationSearchService notificationSearchService;
@Autowired
Expand All @@ -37,7 +37,7 @@ public class NotificationSearchServiceTest {
private NotificationRepository notificationRepository;

@BeforeAll
public void setUp() throws Exception {
void setUp() throws Exception {
User 이브 = userRepository.save(유저_이브());
이브.updateAccessedAt(LocalDate.now().minusDays(1));
userRepository.save(이브);
Expand All @@ -55,17 +55,17 @@ void tearDown() {
}

@Test
public void 오늘_접속_안한_유저의_fcmToken을_조회한다() {
void 오늘_접속_안한_유저의_fcmToken을_조회한다() {
//given
LocalDate date = LocalDate.now();
//when
List<UserFcmToken> userFcmTokens = notificationSearchService.findNotAccessUserFcmToken(date);
//then
assertThat(userFcmTokens.size()).isEqualTo(1);
assertThat(userFcmTokens).hasSize(1);
}

@Test
public void notificationType을_조회한다() {
void notificationType을_조회한다() {
//given
LocalDate date = LocalDate.now();
//when
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@SpringBootTest
public class SchedulerServiceTest {
class SchedulerServiceTest {
@Autowired
private SchedulerService schedulerService;
@Autowired
Expand Down Expand Up @@ -64,7 +64,7 @@ void tearDown() {
}

@Test
public void 스케줄러를_실행한다() {
void 스케줄러를_실행한다() {
//given
schedulerService.makeNotification();
//when
Expand Down

0 comments on commit 3bf0d97

Please sign in to comment.