Created
July 5, 2019 08:50
-
-
Save miyohide/3cf0d0ead1bf3f3cb2613b5dc8e345a6 to your computer and use it in GitHub Desktop.
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
package com.github.miyohide; | |
public class SampleGame { | |
public String play(String p1, String p2) { | |
if ((p1.equals("rock") && p2.equals("scissors")) || | |
(p1.equals("scissors") && p2.equals("paper")) | |
) { | |
return "player1Win"; | |
} | |
return ""; | |
} | |
} |
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
package com.github.miyohide; | |
import org.junit.jupiter.api.Test; | |
import static org.junit.jupiter.api.Assertions.assertEquals; | |
public class SampleGameTest { | |
@Test | |
void rock_vs_scissors_player1Win() { | |
assertEquals("player1Win", new SampleGame().play("rock", "scissors")); | |
} | |
@Test | |
void scissors_vs_paper_player1Win() { | |
assertEquals("player1Win", new SampleGame().play("scissors", "paper")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment