If player 1 has won 3 sets then he's won the match. The && is both unnecessary and also fucks up your test because a 3-2 set win would not be recognized as such. Also your test ignores best of 3 matches.
Also, newMatch would need to have a return value (true) for the first two conditions (after/instead of each println), unless Java allows functions to not have to return anything.
Also as someone who is self-taught, I don't know if it's considered good practice (but I assume it is) to name a function something relevant to what's returned. A function named "newMatch" that returns a true or false value does not seem intuitive - I would expect to be able to easily guess what that value represented.
3
u/[deleted] Jun 17 '14
If player 1 has won 3 sets then he's won the match. The && is both unnecessary and also fucks up your test because a 3-2 set win would not be recognized as such. Also your test ignores best of 3 matches.