From d6b015349158700e307e29b008a5510fbfbc9692 Mon Sep 17 00:00:00 2001 From: Malte Schellhardt Date: Sun, 30 Jan 2022 13:38:43 +0100 Subject: [PATCH] tictactoe: added getter for game board --- src/main/java/de/tims/tictactoe/GameLogic.java | 6 ++++++ src/test/java/de/tims/tictactoe/GameLogicTest.java | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/src/main/java/de/tims/tictactoe/GameLogic.java b/src/main/java/de/tims/tictactoe/GameLogic.java index 5980f54..4e0c81a 100644 --- a/src/main/java/de/tims/tictactoe/GameLogic.java +++ b/src/main/java/de/tims/tictactoe/GameLogic.java @@ -1,5 +1,11 @@ package de.tims.tictactoe; public class GameLogic { + + private int[][] board = new int[3][3]; + + public int[][] getBoard() { + return this.board; + } } diff --git a/src/test/java/de/tims/tictactoe/GameLogicTest.java b/src/test/java/de/tims/tictactoe/GameLogicTest.java index a33d7bb..ecfafb9 100644 --- a/src/test/java/de/tims/tictactoe/GameLogicTest.java +++ b/src/test/java/de/tims/tictactoe/GameLogicTest.java @@ -26,4 +26,12 @@ class GameLogicTest { assertEquals(expectedResult.getClass(), realResult.getClass()); } + @Test + void getBoardTest() { + int[][] expectedResult = new int[3][3]; + int[][] realResult = game.getBoard(); + + assertArrayEquals(expectedResult, realResult); + } + }