Skip to content
Merged
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package com.daedan.festabook;

import com.daedan.festabook.support.AcceptanceTestSupport;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
class FestabookApplicationTests {

@Test
void contextLoads() {
}
class FestabookApplicationTests extends AcceptanceTestSupport {

@Test
void contextLoads() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,20 @@
import com.daedan.festabook.global.lock.ConcurrencyTestHelper;
import com.daedan.festabook.global.security.JwtTestHelper;
import com.daedan.festabook.global.security.role.RoleType;
import com.daedan.festabook.notification.infrastructure.FcmNotificationManager;
import com.daedan.festabook.support.AcceptanceTestSupport;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import io.restassured.http.Header;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayNameGeneration;
import org.junit.jupiter.api.DisplayNameGenerator;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.EnumSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.http.HttpStatus;
import org.springframework.test.context.bean.override.mockito.MockitoBean;

@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
class AnnouncementControllerTest {
class AnnouncementControllerTest extends AcceptanceTestSupport {

private static final String FESTIVAL_HEADER_NAME = "festival";

Expand All @@ -61,17 +52,6 @@ class AnnouncementControllerTest {
@Autowired
private JwtTestHelper jwtTestHelper;

@MockitoBean
private FcmNotificationManager fcmNotificationManager;

@LocalServerPort
private int port;

@BeforeEach
void setUp() {
RestAssured.port = port;
}

@Nested
class createAnnouncement {

Expand Down Expand Up @@ -443,7 +423,7 @@ class sendAnnouncementNotification {
Announcement announcement = AnnouncementFixture.create(festival);
announcementJpaRepository.save(announcement);

willDoNothing().given(fcmNotificationManager)
willDoNothing().given(festivalNotificationManager)
.sendToFestivalTopic(any(), any());

// when & then
Expand All @@ -455,7 +435,7 @@ class sendAnnouncementNotification {
.then()
.statusCode(HttpStatus.OK.value());

then(fcmNotificationManager).should()
then(festivalNotificationManager).should()
.sendToFestivalTopic(any(), any());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,40 +16,25 @@
import com.daedan.festabook.festival.infrastructure.FestivalJpaRepository;
import com.daedan.festabook.global.security.JwtTestHelper;
import com.daedan.festabook.global.security.role.RoleType;
import com.daedan.festabook.support.AcceptanceTestSupport;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import io.restassured.http.Header;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayNameGeneration;
import org.junit.jupiter.api.DisplayNameGenerator;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.http.HttpStatus;

@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
class CouncilControllerTest {
class CouncilControllerTest extends AcceptanceTestSupport {

@Autowired
private FestivalJpaRepository festivalJpaRepository;

@Autowired
private JwtTestHelper jwtTestHelper;

@LocalServerPort
private int port;

@BeforeEach
void setUp() {
RestAssured.port = port;
}

@Nested
class createCouncil {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,19 @@
import com.daedan.festabook.device.dto.DeviceUpdateRequest;
import com.daedan.festabook.device.dto.DeviceUpdateRequestFixture;
import com.daedan.festabook.device.infrastructure.DeviceJpaRepository;
import com.daedan.festabook.support.AcceptanceTestSupport;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayNameGeneration;
import org.junit.jupiter.api.DisplayNameGenerator;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.http.HttpStatus;

@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
class DeviceControllerTest {
class DeviceControllerTest extends AcceptanceTestSupport {

@Autowired
private DeviceJpaRepository deviceJpaRepository;

@LocalServerPort
private int port;

@BeforeEach
void setUp() {
RestAssured.port = port;
}

@Nested
class registerDevice {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.daedan.festabook.festival.infrastructure.FestivalJpaRepository;
import com.daedan.festabook.global.security.JwtTestHelper;
import com.daedan.festabook.global.security.role.RoleType;
import com.daedan.festabook.support.AcceptanceTestSupport;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import io.restassured.http.Header;
Expand All @@ -31,24 +32,15 @@
import java.time.LocalTime;
import java.time.ZoneId;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayNameGeneration;
import org.junit.jupiter.api.DisplayNameGenerator;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.EnumSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.http.HttpStatus;
import org.springframework.test.context.bean.override.mockito.MockitoBean;

@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
class EventControllerTest {
class EventControllerTest extends AcceptanceTestSupport {

@Autowired
private EventDateJpaRepository eventDateJpaRepository;
Expand All @@ -62,17 +54,6 @@ class EventControllerTest {
@Autowired
private JwtTestHelper jwtTestHelper;

@MockitoBean
private Clock clock;

@LocalServerPort
private int port;

@BeforeEach
void setUp() {
RestAssured.port = port;
}

@Nested
class createEvent {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,20 @@
import com.daedan.festabook.festival.infrastructure.FestivalJpaRepository;
import com.daedan.festabook.global.security.JwtTestHelper;
import com.daedan.festabook.global.security.role.RoleType;
import com.daedan.festabook.support.AcceptanceTestSupport;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import io.restassured.http.Header;
import java.time.Clock;
import java.time.LocalDate;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayNameGeneration;
import org.junit.jupiter.api.DisplayNameGenerator;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.http.HttpStatus;
import org.springframework.test.context.bean.override.mockito.MockitoBean;

@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
class EventDateControllerTest {
class EventDateControllerTest extends AcceptanceTestSupport {

private static final String FESTIVAL_HEADER_NAME = "festival";

Expand All @@ -59,17 +50,6 @@ class EventDateControllerTest {
@Autowired
private JwtTestHelper jwtTestHelper;

@MockitoBean
private Clock clock;

@LocalServerPort
private int port;

@BeforeEach
void setUp() {
RestAssured.port = port;
}

@Nested
class createEventDate {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,15 @@
import com.daedan.festabook.festival.dto.FestivalNotificationRequestFixture;
import com.daedan.festabook.festival.infrastructure.FestivalJpaRepository;
import com.daedan.festabook.festival.infrastructure.FestivalNotificationJpaRepository;
import com.daedan.festabook.notification.infrastructure.FcmNotificationManager;
import com.daedan.festabook.support.AcceptanceTestSupport;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayNameGeneration;
import org.junit.jupiter.api.DisplayNameGenerator;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.http.HttpStatus;
import org.springframework.test.context.bean.override.mockito.MockitoBean;

@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
class AndroidFestivalNotificationSubscriptionControllerTest {
class AndroidFestivalNotificationSubscriptionControllerTest extends AcceptanceTestSupport {

@Autowired
private FestivalJpaRepository festivalJpaRepository;
Expand All @@ -44,17 +35,6 @@ class AndroidFestivalNotificationSubscriptionControllerTest {
@Autowired
private FestivalNotificationJpaRepository festivalNotificationJpaRepository;

@MockitoBean
private FcmNotificationManager fcmNotificationManager;

@LocalServerPort
private int port;

@BeforeEach
void setUp() {
RestAssured.port = port;
}

@Nested
class subscribeAndroidFestivalNotification {

Expand Down Expand Up @@ -83,7 +63,7 @@ class subscribeAndroidFestivalNotification {
.body("size()", equalTo(expectedFieldSize))
.body("festivalNotificationId", notNullValue());

then(fcmNotificationManager).should()
then(festivalNotificationManager).should()
.subscribeAndroidFestivalTopic(any(), any());
}

Expand Down Expand Up @@ -113,7 +93,7 @@ class subscribeAndroidFestivalNotification {
.statusCode(HttpStatus.CONFLICT.value())
.body("message", equalTo("FestivalNotification 데이터베이스에 이미 존재합니다."));

then(fcmNotificationManager).shouldHaveNoInteractions();
then(festivalNotificationManager).shouldHaveNoInteractions();
}

@Test
Expand All @@ -136,7 +116,7 @@ class subscribeAndroidFestivalNotification {
.statusCode(HttpStatus.BAD_REQUEST.value())
.body("message", equalTo("존재하지 않는 디바이스입니다."));

then(fcmNotificationManager).shouldHaveNoInteractions();
then(festivalNotificationManager).shouldHaveNoInteractions();
}

@Test
Expand All @@ -160,7 +140,7 @@ class subscribeAndroidFestivalNotification {
.statusCode(HttpStatus.BAD_REQUEST.value())
.body("message", equalTo("존재하지 않는 축제입니다."));

then(fcmNotificationManager).shouldHaveNoInteractions();
then(festivalNotificationManager).shouldHaveNoInteractions();
}
}
}
Loading