-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: 빈 토큰 리스트 호출 오류 수정 * fix: 로그인 시 현재 계정으로 미션 구독 * refactor: fetch join 변경 * rename: 함수명 변경 * fix: fetch join 적용
- Loading branch information
Showing
9 changed files
with
227 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/test/java/com/nexters/goalpanzi/application/firebase/TopicSubscriberImplTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.nexters.goalpanzi.application.firebase; | ||
|
||
import com.google.firebase.messaging.FirebaseMessaging; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.mockito.Mock; | ||
import org.mockito.MockitoAnnotations; | ||
|
||
import java.util.List; | ||
|
||
import static org.mockito.Mockito.*; | ||
|
||
class TopicSubscriberImplTest { | ||
|
||
private TopicSubscriberImpl topicSubscriber; | ||
|
||
@Mock | ||
private FirebaseMessaging firebaseMessaging; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
MockitoAnnotations.openMocks(this); | ||
|
||
topicSubscriber = new TopicSubscriberImpl(); | ||
|
||
mockStatic(FirebaseMessaging.class); | ||
when(FirebaseMessaging.getInstance()).thenReturn(firebaseMessaging); | ||
} | ||
|
||
@Test | ||
void 비어있는_토큰_리스트를_전달하는_경우_FirebaseMessaging을_호출하지_않는다() { | ||
topicSubscriber.subscribeToTopic(List.of(), "topic"); | ||
topicSubscriber.unsubscribeFromTopic(List.of(), "topic"); | ||
|
||
verifyNoInteractions(firebaseMessaging); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/test/java/com/nexters/goalpanzi/domain/device/repository/DeviceRepositoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.nexters.goalpanzi.domain.device.repository; | ||
|
||
import com.nexters.goalpanzi.domain.device.Device; | ||
import com.nexters.goalpanzi.domain.device.OsType; | ||
import com.nexters.goalpanzi.domain.member.Member; | ||
import com.nexters.goalpanzi.domain.member.SocialType; | ||
import com.nexters.goalpanzi.domain.member.repository.MemberRepository; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; | ||
|
||
import java.util.List; | ||
|
||
import static com.nexters.goalpanzi.fixture.DeviceFixture.DEVICE_IDENTIFIER; | ||
import static com.nexters.goalpanzi.fixture.DeviceFixture.DEVICE_TOKEN; | ||
import static com.nexters.goalpanzi.fixture.MemberFixture.EMAIL_HOST; | ||
import static com.nexters.goalpanzi.fixture.MemberFixture.SOCIAL_ID; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@DataJpaTest | ||
class DeviceRepositoryTest { | ||
|
||
@Autowired | ||
private DeviceRepository deviceRepository; | ||
|
||
@Autowired | ||
private MemberRepository memberRepository; | ||
|
||
@Test | ||
void 특정_디바이스를_멤버와_함께_조회한다() { | ||
Member member = memberRepository.save( | ||
Member.socialLogin(SOCIAL_ID, EMAIL_HOST, SocialType.GOOGLE) | ||
); | ||
Device device = deviceRepository.save(new Device(member, DEVICE_IDENTIFIER, DEVICE_TOKEN, OsType.AOS)); | ||
|
||
List<Device> devices = deviceRepository.findAllWithMemberByDeviceIdentifier(device.getDeviceIdentifier()); | ||
assertThat(devices.getFirst().getMember()).isEqualTo(member); | ||
} | ||
} |