|
|
@ -85,15 +85,23 @@ class BordComputerTest { |
|
|
|
@ParameterizedTest |
|
|
|
@MethodSource("playDate") |
|
|
|
void playTest(String testName, String testCase,BordComputer bordComputer,String instanceName) { |
|
|
|
if(testCase.equals("Case1")) { |
|
|
|
bordComputer.meetAllPreconditionForPlay(); |
|
|
|
assertThat(bordComputer.play()).describedAs(testName).isNotEqualTo(null); |
|
|
|
} |
|
|
|
if(testCase.equals("Case2")) { |
|
|
|
Device radioPlayer=bordComputer.getInstanceByName(instanceName); |
|
|
|
bordComputer.setActiveDevice(radioPlayer); |
|
|
|
assertThat(bordComputer.play()).describedAs(testName).isNotEqualTo(null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
static Stream<Arguments> 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") |
|
|
|
Arguments.of("[CDPlayer-> play(): after all preconditions are met] => ShouldReturnAnItemToPlay","Case1",bordComputer,"CDPlayer"), |
|
|
|
Arguments.of("[RadioPlayer-> play(): after all preconditions are met] => ShouldReturnAnItemToPlay","Case2",bordComputer,"RadioPlayer") |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|