package testcase;

import static org.junit.Assert.*;

import org.junit.Test;

import chessGame.ChessMonitoringSystem;
import chessGame.ChessPlayer;
import chessGame.GameMode;
import chessGame.RankScoringMode;
import chessGame.ScoringMode;

public class TestRankScoringMode {
	
	private ChessMonitoringSystem chessMonitoringSystem = ChessMonitoringSystem.getInstance();
	private GameMode mode = new ScoringMode();
	
	@Test
	public void testAddLittleScore() {
		ChessPlayer p1=new ChessPlayer("a", 0);
		int[] scoreRelated={100, 0};
		mode.addScore(p1, scoreRelated);
		int result = p1.getPlayerScore();
		assertEquals(result,8);
	}	
	
	@Test
	public void testAddSameScore() {
		ChessPlayer p1=new ChessPlayer("a", 0);
		int[] scoreRelated={100, 0};
		mode.addScore(p1, scoreRelated);
		int result = p1.getPlayerScore();
		assertEquals(result,8);
	}	
	
	@Test
	public void testAddHigherScore() {
		ChessPlayer p1=new ChessPlayer("a", 0);
		int[] scoreRelated={100, 0};
		mode.addScore(p1, scoreRelated);
		int result = p1.getPlayerScore();
		assertEquals(result,8);
	}	
	
	//test print Result
	@Test
	public void testPrintResultPlayer1Win() {
		ChessPlayer p1=new ChessPlayer("a", 0);
		ChessPlayer p2=new ChessPlayer("b", 1);
		int[] scoreRelated={100, 0};
		mode.addScore(p1, scoreRelated);
		String winner = mode.printResult(p1, p2);
		assertEquals(winner,"a"+ " is the winner!" + "\n" + "winner's score: 100");
	}
	
	@Test
	public void testPrintResultPlayer2Win() {
		ChessPlayer p1=new ChessPlayer("a", 0);
		ChessPlayer p2=new ChessPlayer("b", 1);
		int[] scoreRelated={100, 0};
		mode.addScore(p2, scoreRelated);
		String winner = mode.printResult(p1, p2);
		assertEquals(winner,"b"+ " is the winner!" + "\n" + "winner's score: 100");
	}
	
	@Test
	public void testPrintResultDraw() {
		ChessPlayer p1=new ChessPlayer("a", 0);
		ChessPlayer p2=new ChessPlayer("b", 1);
		String winner = mode.printResult(p1, p2);
		assertEquals(winner,"Draw!");
	}

}

@@ -391,16 +391,20 @@
 e = new 
+Rank
 ScoringM
@@ -410,16 +410,16 @@
 Mode();%0A
-
 %09%0A%09@Test
@@ -614,32 +614,33 @@
 tEquals(result,8
+0
 );%0A%09%7D%09%0A%09%0A%09@Test%0A
@@ -734,33 +734,33 @@
 reRelated=%7B100, 
-0
+2
 %7D;%0A%09%09mode.addSco
@@ -828,32 +828,35 @@
 ssertEquals(
+100, 
 result
-,8
 );%0A%09%7D%09%0A%09%0A%09@T
@@ -956,33 +956,33 @@
 reRelated=%7B100, 
-0
+1
 %7D;%0A%09%09mode.addSco
@@ -1054,24 +1054,27 @@
 tEquals(
+120, 
 result
-,8
 );%0A%09%7D%09%0A%09
@@ -1402,34 +1402,33 @@
 winner's score: 
-10
+8
 0%22);%0A%09%7D%0A%09%0A%09@Test
@@ -1736,18 +1736,17 @@
  score: 
-10
+8
 0%22);%0A%09%7D%0A

Update TestRankScoringMode.java