From f409fdcb75a862ce53712413af2aef5382ad2389 Mon Sep 17 00:00:00 2001 From: Steffen Helmke Date: Mon, 17 Jan 2022 18:50:45 +0100 Subject: [PATCH] 4gewinnt: added getter for player1Score --- src/main/java/de/tims/viergewinnt/ai/Logic.java | 4 ++++ src/test/java/de/tims/viergewinnt/ai/LogicTest.java | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/main/java/de/tims/viergewinnt/ai/Logic.java b/src/main/java/de/tims/viergewinnt/ai/Logic.java index dd8f643..23a9a6b 100644 --- a/src/main/java/de/tims/viergewinnt/ai/Logic.java +++ b/src/main/java/de/tims/viergewinnt/ai/Logic.java @@ -37,6 +37,10 @@ public class Logic { player1Score = score; } + public int getPlayer1Score() { + return player1Score; + } + public int playChip(int column) { //add board update diff --git a/src/test/java/de/tims/viergewinnt/ai/LogicTest.java b/src/test/java/de/tims/viergewinnt/ai/LogicTest.java index 3b5ac6c..c9c2bb0 100644 --- a/src/test/java/de/tims/viergewinnt/ai/LogicTest.java +++ b/src/test/java/de/tims/viergewinnt/ai/LogicTest.java @@ -150,6 +150,16 @@ class LogicTest { assertEquals(expectedResult, testObj.player1Score); } + @Test + void getPlayer1ScoreTest() { + int expectedResult = 500; + testObj.setPlayer1Score(expectedResult); + + int realResult = testObj.getPlayer1Score(); + + assertEquals(expectedResult, realResult); + } + private static Stream playfieldResults() { int[][] playfield1 = {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0},