From 6e34270d95e85839ca0d02360430ba2f4fb11db1 Mon Sep 17 00:00:00 2001 From: fdai7906 Date: Wed, 7 Feb 2024 11:29:49 +0100 Subject: [PATCH 1/4] add boolean facedown in Card --- src/main/java/de/hsfulda/onses/models/Card.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/de/hsfulda/onses/models/Card.java b/src/main/java/de/hsfulda/onses/models/Card.java index 91cab36..b9fc740 100644 --- a/src/main/java/de/hsfulda/onses/models/Card.java +++ b/src/main/java/de/hsfulda/onses/models/Card.java @@ -11,6 +11,7 @@ public class Card { private Color color; private Value value; + private boolean facedown; public enum Color { RED, BLUE, GREEN, YELLOW, BLACK; @@ -41,6 +42,15 @@ public class Card { return this.value; } + public boolean isFacedown() { + return facedown; + } + + public Card setFacedown(boolean facedown) { + this.facedown = facedown; + return this; + } + public PropertyChangeSupport listeners() { if(this.listeners == null) { this.listeners = new PropertyChangeSupport(this); From 5599fc4ee54ba930ba2108a8db9eaea7d0164a35 Mon Sep 17 00:00:00 2001 From: fdai7906 Date: Wed, 7 Feb 2024 11:32:44 +0100 Subject: [PATCH 2/4] refactoring: facedown = false --- src/main/java/de/hsfulda/onses/models/Card.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/hsfulda/onses/models/Card.java b/src/main/java/de/hsfulda/onses/models/Card.java index b9fc740..2dbc3d5 100644 --- a/src/main/java/de/hsfulda/onses/models/Card.java +++ b/src/main/java/de/hsfulda/onses/models/Card.java @@ -11,7 +11,7 @@ public class Card { private Color color; private Value value; - private boolean facedown; + private boolean facedown = false; public enum Color { RED, BLUE, GREEN, YELLOW, BLACK; From f33234439eac04ee1ba1ef0eef1a6cac1dec8d26 Mon Sep 17 00:00:00 2001 From: fdai7906 Date: Wed, 7 Feb 2024 11:41:48 +0100 Subject: [PATCH 3/4] Test.facedownGetter --- src/test/java/de/hsfulda/onses/CardTest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/java/de/hsfulda/onses/CardTest.java b/src/test/java/de/hsfulda/onses/CardTest.java index a2a570a..8f396b5 100644 --- a/src/test/java/de/hsfulda/onses/CardTest.java +++ b/src/test/java/de/hsfulda/onses/CardTest.java @@ -1,6 +1,7 @@ package de.hsfulda.onses; +import de.hsfulda.onses.services.GameService; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; @@ -65,4 +66,14 @@ public class CardTest { assertEquals(expected, answer); } + @Test + @DisplayName("facedownGetter") + public void facedownGetter() { + Card card = new Card(); + boolean answer = card.isFacedown(); + boolean expected = false; + + assertEquals(expected, answer); + } + } \ No newline at end of file From 3f58b776708f8251ce674054341002ccbfaac4c4 Mon Sep 17 00:00:00 2001 From: fdai7906 Date: Wed, 7 Feb 2024 11:49:25 +0100 Subject: [PATCH 4/4] Test.facedownSetter --- src/test/java/de/hsfulda/onses/CardTest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/java/de/hsfulda/onses/CardTest.java b/src/test/java/de/hsfulda/onses/CardTest.java index 8f396b5..d7ea092 100644 --- a/src/test/java/de/hsfulda/onses/CardTest.java +++ b/src/test/java/de/hsfulda/onses/CardTest.java @@ -76,4 +76,15 @@ public class CardTest { assertEquals(expected, answer); } + @Test + @DisplayName("facedownSetter") + public void faceDownSetter() { + Card card = new Card(); + card.setFacedown(true); + boolean answer = card.isFacedown(); + boolean expected = true; + assertEquals(expected, answer); + + } + } \ No newline at end of file