diff --git a/src/main/java/de/hsfulda/onses/models/Card.java b/src/main/java/de/hsfulda/onses/models/Card.java index ab34ad8..74d2393 100644 --- a/src/main/java/de/hsfulda/onses/models/Card.java +++ b/src/main/java/de/hsfulda/onses/models/Card.java @@ -3,18 +3,13 @@ package de.hsfulda.onses.models; public class Card { private int id; private Color color; - private evalue value; + private Value value; public enum Color { RED, BLUE, GREEN, YELLOW, BLACK; }; - public enum evalue { + public enum Value { ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, DRAWTWO, SKIP, REVERSE, CHOOSE, CHOOSEDRAW; - - private static final evalue[] values = evalue.values(); - public static evalue getValue(int n) { - return evalue.values[n]; - } }; public Card setId(int id) { @@ -27,7 +22,7 @@ public class Card { return this; } - public Card setValue(evalue value) { + public Card setValue(Value value) { this.value = value; return this; } @@ -40,7 +35,7 @@ public class Card { return this.color; } - public evalue getValue() { + public Value getValue() { return this.value; } } diff --git a/src/test/java/de/hsfulda/onses/CardTest.java b/src/test/java/de/hsfulda/onses/CardTest.java index fc84c62..f35fa7a 100644 --- a/src/test/java/de/hsfulda/onses/CardTest.java +++ b/src/test/java/de/hsfulda/onses/CardTest.java @@ -17,7 +17,7 @@ public class CardTest { int expected = 5; int ID = 5; // act - Card testcard = new Card().setId(ID).setColor(Card.Color.BLACK).setValue(Card.evalue.FIVE); + Card testcard = new Card().setId(ID).setColor(Card.Color.BLACK).setValue(Card.Value.FIVE); int answer = testcard.getId(); // assert assertEquals(expected, answer); @@ -31,7 +31,7 @@ public class CardTest { int expected = 112; int ID = 112; // act - Card testcard = new Card().setId(ID).setColor(Card.Color.BLUE).setValue(Card.evalue.CHOOSEDRAW); + Card testcard = new Card().setId(ID).setColor(Card.Color.BLUE).setValue(Card.Value.CHOOSEDRAW); int answer = testcard.getId(); // assert assertEquals(expected, answer); @@ -46,7 +46,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.evalue.FIVE); + Card testcard = new Card().setId(9).setColor(color).setValue(Card.Value.FIVE); Card.Color answer = testcard.getColor(); // assert assertEquals(expected, answer); @@ -59,7 +59,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.evalue.CHOOSE); + Card testcard = new Card().setId(15).setColor(color).setValue(Card.Value.CHOOSE); Card.Color answer = testcard.getColor(); // assert assertEquals(expected, answer); @@ -71,11 +71,11 @@ public class CardTest { public void CardTestGetValueThree() { // arrange - Card.evalue expected = Card.evalue.THREE; - Card.evalue value = Card.evalue.THREE; + 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.evalue answer = testcard.getValue(); + Card.Value answer = testcard.getValue(); // assert assertEquals(expected, answer); } @@ -84,11 +84,11 @@ public class CardTest { public void CardTestGetValueSkip() { // arrange - Card.evalue expected = Card.evalue.SKIP; - Card.evalue value = Card.evalue.SKIP; + 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.evalue answer = testcard.getValue(); + Card.Value answer = testcard.getValue(); // assert assertEquals(expected, answer); }