Browse Source

Add swapGeberWaste Funktion and Add Test

feature_solitaer_Geber-_WasteStack
Alexander Hartung 3 years ago
parent
commit
f83db6a3f9
  1. 11
      src/main/java/solitaer/GeberStack.java
  2. 25
      src/test/java/solitaer/GeberStackTest.java

11
src/main/java/solitaer/GeberStack.java

@ -19,6 +19,17 @@ public class GeberStack extends BaseStack {
this.wasteStack = _waste; this.wasteStack = _waste;
} }
public WasteStack getWastStack() {
return wasteStack;
}
public void swapWasteGeber() {
while(wasteStack.stackIsEmpty() == false) {
this.addCard(wasteStack.removeLastCard());
}
}
@Override @Override
protected boolean cardCheck(Card _topStack, Card _playerCard) { protected boolean cardCheck(Card _topStack, Card _playerCard) {
// TODO Auto-generated method stub // TODO Auto-generated method stub

25
src/test/java/solitaer/GeberStackTest.java

@ -0,0 +1,25 @@
package solitaer;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
class GeberStackTest {
@Test
void testswapGeberWaste001() {
WasteStack waste = new WasteStack(0, 0);
GeberStack geber = new GeberStack(0, 0, waste);
for (int i = 1; i < 14; i++) {
waste.addCard(new Card(0, Symbol.Pik, false));
}
int expectedResult = waste.stackSize();
geber.swapWasteGeber();
assertEquals(geber.stackSize(), expectedResult, "same Size");
}
}
Loading…
Cancel
Save