diff --git a/src/main/java/BordComputer.java b/src/main/java/BordComputer.java index 7563899..6dda364 100644 --- a/src/main/java/BordComputer.java +++ b/src/main/java/BordComputer.java @@ -1,4 +1,8 @@ import device.Device; +import device.cdPlayer.CD; +import device.cdPlayer.CDPlayer; +import device.radioPlayer.RadioPlayer; +import device.usbPlayer.UsbPlayer; import java.io.FileReader; import java.lang.reflect.InvocationTargetException; @@ -35,4 +39,43 @@ public class BordComputer { installedDevices[i] = (Device) c.getConstructor().newInstance(); } } + + public String play(){ + String itemToPlay=activeDevice.play(); + return itemToPlay; + } + + //===== Hilf-Funktionen ====== + + public Object getInstanceByName(String deviceName){ + for (int i = 0; i playDate()throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException { + BordComputer bordComputer = new BordComputer(); + bordComputer.readConfig(); + return Stream.of( + Arguments.of("[CDPlayer-> play(): after all preconditions are met] => ShouldReturnAnItemToPlay","Case1",bordComputer,"CDPlayer") + ); + } + + } \ No newline at end of file diff --git a/src/test/java/device/cdPlayer/CDPlayerTest.java b/src/test/java/device/cdPlayer/CDPlayerTest.java index 06cdff8..d45992d 100644 --- a/src/test/java/device/cdPlayer/CDPlayerTest.java +++ b/src/test/java/device/cdPlayer/CDPlayerTest.java @@ -30,7 +30,8 @@ class CDPlayerTest { Exception newException=assertThrows(exception.getClass(),()->_cdPlayer.play()); assertEquals(expectedResult, newException.getMessage()); }else{ - assertThat(_cdPlayer.play()).describedAs(testName).isEqualTo(expectedResult); + _cdPlayer.play(); + assertThat(_cdPlayer.getStatus()).describedAs(testName).isEqualTo(expectedResult); } } static Stream playTestData () {