Browse Source

Added device inteface and first device RadioPlayer

pull/1/head
alpina0707 3 years ago
parent
commit
381aff8ab0
  1. 3
      Geraete.config
  2. 10
      src/main/java/Dog.java
  3. 14
      src/main/java/device/Device.java
  4. 48
      src/main/java/device/RadioPlayer.java
  5. 15
      src/test/java/DogTest.java
  6. 44
      src/test/java/device/RadioPlayerTest.java

3
Geraete.config

@ -0,0 +1,3 @@
CD=device.CdPlayer
Radio=device.RadioPlayer
USB=device.UsbPlayer

10
src/main/java/Dog.java

@ -1,10 +0,0 @@
public class Dog {
private String name;
private Float weight;
public Dog(String name, double weight) {
}
}

14
src/main/java/device/Device.java

@ -0,0 +1,14 @@
package device;
public interface Device {
void louder();
void quiter();
int getVolume();
void next();
void prev();
String getInfoText();
String[] getOptions();
void chooseOption(String opt);
String play();
}

48
src/main/java/device/RadioPlayer.java

@ -0,0 +1,48 @@
package device;
public class RadioPlayer implements Device {
@Override
public void louder() {
}
@Override
public void quiter() {
}
@Override
public int getVolume() {
return 0;
}
@Override
public void next() {
}
@Override
public void prev() {
}
@Override
public String getInfoText() {
return null;
}
@Override
public String[] getOptions() {
return new String[0];
}
@Override
public void chooseOption(String opt) {
}
@Override
public String play() {
return null;
}
}

15
src/test/java/DogTest.java

@ -1,15 +0,0 @@
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.*;
class DogTest {
Dog fido = new Dog("Fido", 5.25);
Dog fidosClone = new Dog("Fido", 5.25);
@Test
void test() {
assertThat(fido).isEqualToComparingFieldByFieldRecursively(fidosClone);
}
}

44
src/test/java/device/RadioPlayerTest.java

@ -0,0 +1,44 @@
package device;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class RadioPlayerTest {
@Test
void louder() {
}
@Test
void quiter() {
}
@Test
void getVolume() {
}
@Test
void next() {
}
@Test
void prev() {
}
@Test
void getInfoText() {
}
@Test
void getOptions() {
}
@Test
void chooseOption() {
}
@Test
void play() {
}
}
Loading…
Cancel
Save