Skip to content

Commit

Permalink
feat: 테스트 환경에서 FirebaseMessaging 을 MockBean 으로 등록한다
Browse files Browse the repository at this point in the history
  • Loading branch information
BGuga committed Sep 15, 2023
1 parent bff5dd5 commit a304bce
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions backend/src/main/java/com/festago/fcm/config/FCMConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.core.io.ClassPathResource;

@Configuration
@Profile("!test")
public class FCMConfig {

@Value("${fcm.key.path}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
package com.festago;

import com.google.firebase.messaging.FirebaseMessaging;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;

@SpringBootTest
class FestaGoApplicationTests {

@MockBean
FirebaseMessaging firebaseMessaging;

@Test
void contextLoads() {
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package com.festago.application.integration;

import com.festago.support.DatabaseClearExtension;
import com.google.firebase.messaging.FirebaseMessaging;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.mock.mockito.MockBean;

@SpringBootTest(webEnvironment = WebEnvironment.NONE)
@ExtendWith(DatabaseClearExtension.class)
public abstract class ApplicationIntegrationTest {

}
@MockBean
FirebaseMessaging firebaseMessaging;
}

0 comments on commit a304bce

Please sign in to comment.