From 381aff8ab0dc0142b7ad3a9cc4e12ec9c5169fd6 Mon Sep 17 00:00:00 2001 From: alpina0707 Date: Fri, 28 Jan 2022 14:19:27 +0100 Subject: [PATCH] Added device inteface and first device RadioPlayer --- Geraete.config | 3 ++ src/main/java/Dog.java | 10 ----- src/main/java/device/Device.java | 14 +++++++ src/main/java/device/RadioPlayer.java | 48 +++++++++++++++++++++++ src/test/java/DogTest.java | 15 ------- src/test/java/device/RadioPlayerTest.java | 44 +++++++++++++++++++++ 6 files changed, 109 insertions(+), 25 deletions(-) create mode 100644 Geraete.config delete mode 100644 src/main/java/Dog.java create mode 100644 src/main/java/device/Device.java create mode 100644 src/main/java/device/RadioPlayer.java delete mode 100644 src/test/java/DogTest.java create mode 100644 src/test/java/device/RadioPlayerTest.java diff --git a/Geraete.config b/Geraete.config new file mode 100644 index 0000000..cb2ada9 --- /dev/null +++ b/Geraete.config @@ -0,0 +1,3 @@ +CD=device.CdPlayer +Radio=device.RadioPlayer +USB=device.UsbPlayer \ No newline at end of file diff --git a/src/main/java/Dog.java b/src/main/java/Dog.java deleted file mode 100644 index bd85775..0000000 --- a/src/main/java/Dog.java +++ /dev/null @@ -1,10 +0,0 @@ -public class Dog { - private String name; - private Float weight; - - public Dog(String name, double weight) { - - } - - -} \ No newline at end of file diff --git a/src/main/java/device/Device.java b/src/main/java/device/Device.java new file mode 100644 index 0000000..ca361d6 --- /dev/null +++ b/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(); + } diff --git a/src/main/java/device/RadioPlayer.java b/src/main/java/device/RadioPlayer.java new file mode 100644 index 0000000..07d220b --- /dev/null +++ b/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; + } +} diff --git a/src/test/java/DogTest.java b/src/test/java/DogTest.java deleted file mode 100644 index 889fc34..0000000 --- a/src/test/java/DogTest.java +++ /dev/null @@ -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); - } - -} \ No newline at end of file diff --git a/src/test/java/device/RadioPlayerTest.java b/src/test/java/device/RadioPlayerTest.java new file mode 100644 index 0000000..50a756a --- /dev/null +++ b/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() { + } +} \ No newline at end of file