Browse Source

BordComputer.play; instance of RadioPlayer -> without fulfilling preconditions: ShouldWorkWell.

feature-pr-lastUpdate
JPANZO 2 years ago
parent
commit
f5aa15071d
  1. 10
      src/test/java/BordComputerTest.java

10
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<Arguments> 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")
);
}

Loading…
Cancel
Save