From 3f1d220ac84f5b77a9d29983fce2aa97d9770b3d Mon Sep 17 00:00:00 2001 From: JPANZO Date: Thu, 17 Feb 2022 21:45:43 +0100 Subject: [PATCH] Method mute of CDPlayer tested on checkingTheReturnValue -> ShouldReturnAString. --- src/main/java/device/cdPlayer/CDPlayer.java | 2 +- src/test/java/device/cdPlayer/CDPlayerTest.java | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/device/cdPlayer/CDPlayer.java b/src/main/java/device/cdPlayer/CDPlayer.java index 304d03d..e1da09f 100644 --- a/src/main/java/device/cdPlayer/CDPlayer.java +++ b/src/main/java/device/cdPlayer/CDPlayer.java @@ -109,7 +109,7 @@ public class CDPlayer implements Device { @Override public String mute() { - return null; + return ("Volume muted."); } @Override diff --git a/src/test/java/device/cdPlayer/CDPlayerTest.java b/src/test/java/device/cdPlayer/CDPlayerTest.java index c3cda36..354719a 100644 --- a/src/test/java/device/cdPlayer/CDPlayerTest.java +++ b/src/test/java/device/cdPlayer/CDPlayerTest.java @@ -493,7 +493,7 @@ class CDPlayerTest { @ParameterizedTest @MethodSource("addToFavoriteSongsData") - void addToFavoriteSongs(String testName,String cases, CDPlayer _cdPlayer,Exception exception) { + void addToFavoriteSongsTest(String testName,String cases, CDPlayer _cdPlayer,Exception exception) { if(cases.equals("Case1")) { String myFavoriteSong = _cdPlayer.getCD().getPlayList()[0]; _cdPlayer.addToFavoriteSongs(myFavoriteSong); @@ -531,4 +531,19 @@ class CDPlayerTest { ); } + @ParameterizedTest + @MethodSource("muteTestData") + void muteTest(String testName,String cases, CDPlayer _cdPlayer,String expectedResult) { + assertThat(_cdPlayer.mute()).describedAs(testName).isEqualTo(expectedResult); + } + static Stream muteTestData () { + CDPlayer cdPlayer1 = new CDPlayer(); + return Stream.of( + Arguments.of("[mute() by checkingTheReturnValue ] => ShouldReturnAString", "Case1", cdPlayer1, "Volume muted.") + ); + } + + + + } \ No newline at end of file