Browse Source

Merge branch 'features' into 'main'

Features

See merge request fdai7736/onses!23
main
fdai7906 12 months ago
parent
commit
8709aed6d7
  1. 10
      src/main/java/de/hsfulda/onses/models/Card.java
  2. 22
      src/test/java/de/hsfulda/onses/CardTest.java

10
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 = false;
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);

22
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,25 @@ 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);
}
@Test
@DisplayName("facedownSetter")
public void faceDownSetter() {
Card card = new Card();
card.setFacedown(true);
boolean answer = card.isFacedown();
boolean expected = true;
assertEquals(expected, answer);
}
}
Loading…
Cancel
Save