-
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.
- Loading branch information
1 parent
e645187
commit fc148b4
Showing
2 changed files
with
77 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
51 changes: 51 additions & 0 deletions
51
src/test/java/com/mirkoebert/simplejavaradioplayer/player/ResilientStreamPlayerTest.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,51 @@ | ||
package com.mirkoebert.simplejavaradioplayer.player; | ||
|
||
import com.goxr3plus.streamplayer.enums.Status; | ||
import lombok.SneakyThrows; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.test.context.bean.override.mockito.MockitoBean; | ||
import org.springframework.test.context.junit.jupiter.SpringExtension; | ||
|
||
import java.net.URL; | ||
|
||
import static org.mockito.ArgumentMatchers.any; | ||
import static org.mockito.Mockito.verify; | ||
import static org.mockito.Mockito.when; | ||
|
||
@ExtendWith(SpringExtension.class) | ||
@Import(ResilientStreamPlayer.class) | ||
class ResilientStreamPlayerTest { | ||
|
||
@MockitoBean | ||
private Mp3StreamPlayer mp3StreamPlayer; | ||
@Autowired | ||
private ResilientStreamPlayer cut; | ||
|
||
@SneakyThrows | ||
@Test | ||
void playStream() { | ||
cut.playStream(null); | ||
|
||
//cut.playStream(new URL("malformed url")); | ||
cut.playStream(new URL("http://ebert-p.com")); | ||
verify(mp3StreamPlayer).playStream(any()); | ||
} | ||
|
||
@Test | ||
void watchDogPlayerStatusNull() { | ||
cut.watchDog(); | ||
} | ||
|
||
@Test | ||
void watchDog() { | ||
when(mp3StreamPlayer.getStatus()).thenReturn(Status.PLAYING); | ||
cut.watchDog(); | ||
} | ||
|
||
@Test | ||
void stop() { | ||
} | ||
} |