mirror of
https://github.com/danieldemus/openhab-core.git
synced 2026-07-29 12:34:22 +02:00
Print message instead of null on console when specified play volume is invalid (#670)
The fix helps users and also ensures the unit test works on both Java 8 and 11. Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
committed by
Christoph Weitkamp
parent
71b241ae21
commit
7e94df1656
+1
-1
@@ -144,7 +144,7 @@ public class AudioConsoleCommandExtension extends AbstractConsoleCommandExtensio
|
||||
try {
|
||||
volume = PercentType.valueOf(args[2]);
|
||||
} catch (Exception e) {
|
||||
console.println(e.getMessage());
|
||||
console.println("Specify volume as percentage between 0 and 100");
|
||||
break;
|
||||
}
|
||||
playOnSinks(args[0], args[1], volume, console);
|
||||
|
||||
+2
-1
@@ -140,7 +140,8 @@ public class AudioConsoleTest extends AbstractAudioServeltTest {
|
||||
fileHandler.wavFileName(), "invalid" };
|
||||
audioConsoleCommandExtension.execute(args, consoleMock);
|
||||
|
||||
waitForAssert(() -> assertThat("The given volume was invalid", consoleOutput, nullValue()));
|
||||
waitForAssert(() -> assertThat("The given volume was invalid", consoleOutput,
|
||||
is("Specify volume as percentage between 0 and 100")));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user