Created
June 1, 2018 18:09
-
-
Save CollectiveHealth-gists/dd79f27dbfe732b78cc396335932fc4b to your computer and use it in GitHub Desktop.
ComputerTest implemented using setters.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ComputerTestUsingSetter { | |
@Test | |
public void testPlayVideo() { | |
Computer computer = new Computer(); | |
MotherBoard motherBoard = new MotherBoard(); | |
SoundCard soundCard = new SoundCard(); | |
VideoCard videoCard = new VideoCard(); | |
SoundSystem soundSystem = Mockito.mock(SoundSystem.class); | |
DisplaySystem displaySystem = Mockito.mock(DisplaySystem.class); | |
computer.setMotherBoard(motherBoard); | |
motherBoard.setSoundCard(soundCard); | |
motherBoard.setVideoCard(videoCard); | |
soundCard.setConnectedExternalSystem(soundSystem); | |
videoCard.setConnectedExternalSystem(displaySystem); | |
computer.playVideo(); | |
Mockito.verify(soundSystem).playAudio(Mockito.any()); | |
Mockito.verify(displaySystem).playVideo(Mockito.any()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment