From f5aa15071da9ee2a522145d92af800cb683c61de Mon Sep 17 00:00:00 2001 From: JPANZO Date: Fri, 18 Feb 2022 18:48:44 +0100 Subject: [PATCH] BordComputer.play; instance of RadioPlayer -> without fulfilling preconditions: ShouldWorkWell. --- src/test/java/BordComputerTest.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/test/java/BordComputerTest.java b/src/test/java/BordComputerTest.java index 0242bcd..e9a8309 100644 --- a/src/test/java/BordComputerTest.java +++ b/src/test/java/BordComputerTest.java @@ -108,10 +108,17 @@ class BordComputerTest { assertEquals(newException.getMessage(), "No Item returned even all preconditions are met."); } if(testCase.equals("Case5")) { + Device usbPlayer=bordComputer.getInstanceByName(instanceName); + bordComputer.setActiveDevice(usbPlayer); Exception newException = assertThrows(NoItemEvenAllPreconditionAreMet.class, () -> bordComputer.play()); assertEquals(NoItemEvenAllPreconditionAreMet.class, newException.getClass()); assertEquals(newException.getMessage(), "No Item returned even all preconditions are met."); } + if(testCase.equals("Case6")) { + Device radioPlayer=bordComputer.getInstanceByName(instanceName); + bordComputer.setActiveDevice(radioPlayer); + assertDoesNotThrow(() -> bordComputer.play()); + } } static Stream playDate()throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException { @@ -126,7 +133,8 @@ class BordComputerTest { Arguments.of("[RadioPlayer-> play(): after all preconditions are met] => ShouldReturnAnItemToPlay","Case2",bordComputer,"RadioPlayer"), Arguments.of("[UsbPlayer-> play(): after all preconditions are met] => ShouldReturnAnItemToPlay","Case3",bordComputer,"UsbPlayer"), Arguments.of("[CDPlayer-> play(): without fulfilling preconditions] => ShouldReturnAnException","Case4",bordComputer2,"CDPlayer"), - Arguments.of("[UsbPlayer-> play(): without fulfilling preconditions] => ShouldReturnAnException","Case5",bordComputer2,"UsbPlayer") + Arguments.of("[UsbPlayer-> play(): without fulfilling preconditions] => ShouldReturnAnException","Case5",bordComputer2,"UsbPlayer"), + Arguments.of("[RadioPlayer-> play(): without fulfilling preconditions] => ShouldWorkWell","Case6",bordComputer2,"RadioPlayer") ); }