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

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

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

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

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

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

@ -6,7 +6,7 @@ public class UsbPlayer implements Device{
public void louder() { public void louder() {
} }
/*
@Override @Override
public void quieter() { public void quieter() {
@ -47,5 +47,4 @@ public class UsbPlayer implements Device{
return null; 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.*; import static org.junit.jupiter.api.Assertions.*;
class CDPlayerTest { class CDPlayerTest {
/*
@Test @Test
void louder() { void louder() {
} }
@ -41,4 +41,6 @@ class CDPlayerTest {
@Test @Test
void play() { void play() {
} }
*/
} }

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

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

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

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