From abf623a3285154f188045b9f4559ae92a2ddaaa7 Mon Sep 17 00:00:00 2001 From: fdai6499 Date: Mon, 16 Jan 2023 11:15:25 +0100 Subject: [PATCH] changed ModelTest.java the toString test. Comparing of returned string with an static string --- src/test/java/ModelTest.java | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/test/java/ModelTest.java b/src/test/java/ModelTest.java index d9c7fb4..1068b40 100644 --- a/src/test/java/ModelTest.java +++ b/src/test/java/ModelTest.java @@ -9,6 +9,7 @@ public class ModelTest extends MainFrame { @Test public void test_toString() { + GameField gameField = new GameField(360); for (int i = 0; i < 9; i++) { @@ -19,7 +20,23 @@ public class ModelTest extends MainFrame { Model model = new Model(gameField); - System.out.println(model); + String staticCase = + "X 0 1 2 3 4 5 6 7 8\n" + + " ------------------------\n" + + "0 | 0 0 0 0 0 0 0 0 0\n" + + "1 | 1 1 1 1 1 1 1 1 1\n" + + "2 | 2 2 2 2 2 2 2 2 2\n" + + " |\n" + + "3 | 3 3 3 3 3 3 3 3 3\n" + + "4 | 4 4 4 4 4 4 4 4 4\n" + + "5 | 5 5 5 5 5 5 5 5 5\n" + + " |\n" + + "6 | 6 6 6 6 6 6 6 6 6\n" + + "7 | 7 7 7 7 7 7 7 7 7\n" + + "8 | 8 8 8 8 8 8 8 8 8\n"; + + + assertEquals(model.toString(), staticCase, "tested Overridden toString of Model.class"); } @Test @@ -115,7 +132,7 @@ public class ModelTest extends MainFrame { } } - assertTrue(a); + assertTrue(a, "arrangement of set values of parsing from GameField"); } @Test