From d352decf1d913596025c42d7926d3f2bbc3a2843 Mon Sep 17 00:00:00 2001 From: fdai7906 Date: Tue, 6 Feb 2024 20:28:24 +0100 Subject: [PATCH] refactoring: delete CardId --- .../java/de/hsfulda/onses/models/Card.java | 10 ------ src/test/java/de/hsfulda/onses/CardTest.java | 36 +++---------------- 2 files changed, 4 insertions(+), 42 deletions(-) diff --git a/src/main/java/de/hsfulda/onses/models/Card.java b/src/main/java/de/hsfulda/onses/models/Card.java index 74d2393..aaa408a 100644 --- a/src/main/java/de/hsfulda/onses/models/Card.java +++ b/src/main/java/de/hsfulda/onses/models/Card.java @@ -1,7 +1,6 @@ package de.hsfulda.onses.models; public class Card { - private int id; private Color color; private Value value; @@ -12,11 +11,6 @@ public class Card { ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, DRAWTWO, SKIP, REVERSE, CHOOSE, CHOOSEDRAW; }; - public Card setId(int id) { - this.id = id; - return this; - } - public Card setColor(Color color) { this.color = color; return this; @@ -27,10 +21,6 @@ public class Card { return this; } - public int getId() { - return this.id; - } - public Color getColor() { return this.color; } diff --git a/src/test/java/de/hsfulda/onses/CardTest.java b/src/test/java/de/hsfulda/onses/CardTest.java index f35fa7a..a2a570a 100644 --- a/src/test/java/de/hsfulda/onses/CardTest.java +++ b/src/test/java/de/hsfulda/onses/CardTest.java @@ -9,34 +9,6 @@ import de.hsfulda.onses.models.Card; public class CardTest { - @Test - @DisplayName("CardGetID5") - public void CardTestGetID5() { - - // arrange - int expected = 5; - int ID = 5; - // act - Card testcard = new Card().setId(ID).setColor(Card.Color.BLACK).setValue(Card.Value.FIVE); - int answer = testcard.getId(); - // assert - assertEquals(expected, answer); - } - - @Test - @DisplayName("CardGetID112") - public void CardTestGetID112() { - - // arrange - int expected = 112; - int ID = 112; - // act - Card testcard = new Card().setId(ID).setColor(Card.Color.BLUE).setValue(Card.Value.CHOOSEDRAW); - int answer = testcard.getId(); - // assert - assertEquals(expected, answer); - } - @Test @DisplayName("CardGetColorBlue") @@ -46,7 +18,7 @@ public class CardTest { Card.Color expected = Card.Color.BLUE; Card.Color color = Card.Color.BLUE; // act - Card testcard = new Card().setId(9).setColor(color).setValue(Card.Value.FIVE); + Card testcard = new Card().setColor(color).setValue(Card.Value.FIVE); Card.Color answer = testcard.getColor(); // assert assertEquals(expected, answer); @@ -59,7 +31,7 @@ public class CardTest { Card.Color expected = Card.Color.BLACK; Card.Color color = Card.Color.BLACK; // act - Card testcard = new Card().setId(15).setColor(color).setValue(Card.Value.CHOOSE); + Card testcard = new Card().setColor(color).setValue(Card.Value.CHOOSE); Card.Color answer = testcard.getColor(); // assert assertEquals(expected, answer); @@ -74,7 +46,7 @@ public class CardTest { Card.Value expected = Card.Value.THREE; Card.Value value = Card.Value.THREE; // act - Card testcard = new Card().setId(2).setColor(Card.Color.BLUE).setValue(value); + Card testcard = new Card().setColor(Card.Color.BLUE).setValue(value); Card.Value answer = testcard.getValue(); // assert assertEquals(expected, answer); @@ -87,7 +59,7 @@ public class CardTest { Card.Value expected = Card.Value.SKIP; Card.Value value = Card.Value.SKIP; // act - Card testcard = new Card().setId(19).setColor(Card.Color.BLACK).setValue(value); + Card testcard = new Card().setColor(Card.Color.BLACK).setValue(value); Card.Value answer = testcard.getValue(); // assert assertEquals(expected, answer);