diff --git a/src/main/java/solitaer/GeberStack.java b/src/main/java/solitaer/GeberStack.java index 9e10e10..1136daa 100644 --- a/src/main/java/solitaer/GeberStack.java +++ b/src/main/java/solitaer/GeberStack.java @@ -19,6 +19,17 @@ public class GeberStack extends BaseStack { this.wasteStack = _waste; } + public WasteStack getWastStack() { + return wasteStack; + } + + public void swapWasteGeber() { + while(wasteStack.stackIsEmpty() == false) { + this.addCard(wasteStack.removeLastCard()); + } + } + + @Override protected boolean cardCheck(Card _topStack, Card _playerCard) { // TODO Auto-generated method stub diff --git a/src/test/java/solitaer/GeberStackTest.java b/src/test/java/solitaer/GeberStackTest.java new file mode 100644 index 0000000..0115389 --- /dev/null +++ b/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"); + } + +}