Browse Source

RadioPlayer added quieter function + AssertJ test for quieter

feature-dev-rp_prev
alpina0707 3 years ago
parent
commit
27bcf334bb
  1. 3
      src/main/java/device/CDPlayer.java
  2. 5
      src/main/java/device/Device.java
  3. 11
      src/main/java/device/RadioPlayer.java
  4. 3
      src/main/java/device/UsbPlayer.java
  5. 4
      src/test/java/device/CDPlayerTest.java
  6. 6
      src/test/java/device/RadioPlayerTest.java
  7. 2
      src/test/java/device/UsbPlayerTest.java

3
src/main/java/device/CDPlayer.java

@ -5,7 +5,7 @@ public class CDPlayer implements Device {
public void louder() {
}
/*
@Override
public void quieter() {
@ -46,5 +46,4 @@ public class CDPlayer implements Device {
return null;
}
*/
}

5
src/main/java/device/Device.java

@ -3,10 +3,7 @@ package device;
public interface Device {
void louder();
/*
void quieter();
void quiter();
int getVolume();
void next();
void prev();
@ -15,5 +12,5 @@ public interface Device {
void chooseOption(String opt);
String play();
*/
}

11
src/main/java/device/RadioPlayer.java

@ -19,12 +19,15 @@ public class RadioPlayer implements Device {
Lautstaerke = 100;
}
}
/*
@Override
public void quieter() {
if(Lautstaerke > 0) {
Lautstaerke -= 1;
} else {
Lautstaerke = 0;
}
}
@Override
public int getVolume() {
return 0;
@ -59,6 +62,4 @@ public class RadioPlayer implements Device {
public String play() {
return null;
}
*/
}

3
src/main/java/device/UsbPlayer.java

@ -6,7 +6,7 @@ public class UsbPlayer implements Device{
public void louder() {
}
/*
@Override
public void quieter() {
@ -47,5 +47,4 @@ public class UsbPlayer implements Device{
return null;
}
*/
}

4
src/test/java/device/CDPlayerTest.java

@ -5,7 +5,7 @@ import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class CDPlayerTest {
/*
@Test
void louder() {
}
@ -41,4 +41,6 @@ class CDPlayerTest {
@Test
void play() {
}
*/
}

6
src/test/java/device/RadioPlayerTest.java

@ -22,11 +22,15 @@ class RadioPlayerTest {
rp.louder();
assertThat(rp.getLautstaerke()).isEqualTo(100);
}
/*
@Test
void quieter() {
rp.setLautstaerke(1);
rp.quieter();
assertThat(rp.getLautstaerke()).isEqualTo(0);
}
/*
@Test
void getVolume() {
}

2
src/test/java/device/UsbPlayerTest.java

@ -6,6 +6,7 @@ import static org.junit.jupiter.api.Assertions.*;
class UsbPlayerTest {
/*
@Test
void louder() {
}
@ -41,4 +42,5 @@ class UsbPlayerTest {
@Test
void play() {
}
*/
}
Loading…
Cancel
Save