Browse Source

Test-Code for CDPlayer-Method [Louder] produced.

feature-pr-cdPlayerLouderTest
JPANZO 3 years ago
parent
commit
192dbd4fc3
  1. 58
      src/test/java/device/cdPlayer/CDPlayerTest.java

58
src/test/java/device/cdPlayer/CDPlayerTest.java

@ -1,47 +1,43 @@
package device.cdPlayer; package device.cdPlayer;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.mockito.junit.jupiter.MockitoExtension;
import static org.junit.jupiter.api.Assertions.*;
import java.util.stream.Stream;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.*;
@ExtendWith(MockitoExtension.class)
class CDPlayerTest { class CDPlayerTest {
/*
@Test
void louder() {
}
@Test
void quieter() {
}
@Test
void getVolume() {
}
@Test
void next() {
}
@Test
void prev() {
@ParameterizedTest
@MethodSource("louderTestData")
void louderTest(String testName,String testDirection, CDPlayer _cdPlayer,int anzClicks, int expectedResult) {
for (int i = 0; i < anzClicks; i++) {
_cdPlayer.louder();
} }
@Test
void getInfoText() {
if(testDirection.equals("VolumeIncreased")){
assertThat(_cdPlayer.getVolume()).describedAs(testName).isEqualTo(expectedResult);
} }
@Test
void getOptions() {
if(testDirection.equals("VolumeHasChanged")){
assertThat(_cdPlayer.getVolume()).describedAs(testName).isNotEqualTo(expectedResult);
}if(testDirection.equals("VolumeNotDecreased")){
assertThat(_cdPlayer.getVolume()).describedAs(testName).isNotEqualTo(expectedResult);
} }
@Test
void chooseOption() {
} }
@Test
void play() {
static Stream<Arguments> louderTestData () {
CDPlayer cdPlayer=new CDPlayer();
return Stream.of(
Arguments.of("[getVolume() after 20x louder() ] => VolumeIncreased","VolumeIncreased", cdPlayer, 20, 20),
Arguments.of("[getVolume() after 2x louder() ] => VolumeHasChanged","VolumeHasChanged" ,cdPlayer,2,0),
Arguments.of("[getVolume() after 5x louder() ] => VolumeDecreased","VolumeNotDecreased", cdPlayer,5,-5)
);
} }
*/
} }
Loading…
Cancel
Save