Fixed Tests

This commit is contained in:
2025-01-20 13:31:54 +01:00
parent b6812d1223
commit 5b37ebb01d
10 changed files with 72 additions and 49 deletions

View File

@@ -31,7 +31,7 @@ object TUIMain extends CustomThread with EventListener with UI {
setName("TUI") setName("TUI")
private var init = false var init = false
private var internState: GameState = GameState.NO_SET private var internState: GameState = GameState.NO_SET
override def instance: CustomThread = TUIMain override def instance: CustomThread = TUIMain

View File

@@ -1,4 +1,5 @@
package de.knockoutwhist.cards package de.knockoutwhist.cards
import de.knockoutwhist.KnockOutWhist
import de.knockoutwhist.cards.base.CardBaseManager import de.knockoutwhist.cards.base.CardBaseManager
import de.knockoutwhist.testutils.TestUtil import de.knockoutwhist.testutils.TestUtil
import de.knockoutwhist.ui.tui.TUIMain.TUICards.renderCardAsString import de.knockoutwhist.ui.tui.TUIMain.TUICards.renderCardAsString
@@ -41,9 +42,10 @@ class CardTests extends AnyWordSpec with Matchers{
renderCardAsString(Card(CardValue.Ten, Suit.Spades)) shouldBe expectedResult renderCardAsString(Card(CardValue.Ten, Suit.Spades)) shouldBe expectedResult
} }
"be able to reset the order" in { "be able to reset the order" in {
CardBaseManager.shuffleAndReset() val cardManager = KnockOutWhist.config.cardManager
CardBaseManager.resetOrder() cardManager.shuffleAndReset()
val card = CardBaseManager.nextCard() cardManager.resetOrder()
val card = cardManager.nextCard()
card.suit shouldBe Suit.Spades card.suit shouldBe Suit.Spades
card.cardValue shouldBe CardValue.Two card.cardValue shouldBe CardValue.Two
} }

View File

@@ -1,5 +1,6 @@
package de.knockoutwhist.cards package de.knockoutwhist.cards
import de.knockoutwhist.KnockOutWhist
import de.knockoutwhist.cards.base.CardBaseManager import de.knockoutwhist.cards.base.CardBaseManager
import de.knockoutwhist.testutils.TestUtil import de.knockoutwhist.testutils.TestUtil
import org.scalatest.matchers.must.Matchers import org.scalatest.matchers.must.Matchers
@@ -11,50 +12,56 @@ class DeckTests extends AnyWordSpec with Matchers{
"A deck" should { "A deck" should {
TestUtil.disableDelay() TestUtil.disableDelay()
"not be empty" in { "not be empty" in {
CardBaseManager.cardContainer must not be empty KnockOutWhist.config.cardManager.cardContainer must not be empty
} }
"have 52 cards" in { "have 52 cards" in {
CardBaseManager.cardContainer must have size 52 KnockOutWhist.config.cardManager.cardContainer must have size 52
} }
"contain 13 cards of spades" in { "contain 13 cards of spades" in {
CardBaseManager.cardContainer.count(_.suit == Suit.Spades) mustBe 13 KnockOutWhist.config.cardManager.cardContainer.count(_.suit == Suit.Spades) mustBe 13
} }
"contain 13 cards of hearts" in { "contain 13 cards of hearts" in {
CardBaseManager.cardContainer.count(_.suit == Suit.Hearts) mustBe 13 KnockOutWhist.config.cardManager.cardContainer.count(_.suit == Suit.Hearts) mustBe 13
} }
"contain 13 cards of diamonds" in { "contain 13 cards of diamonds" in {
CardBaseManager.cardContainer.count(_.suit == Suit.Diamonds) mustBe 13 KnockOutWhist.config.cardManager.cardContainer.count(_.suit == Suit.Diamonds) mustBe 13
} }
"contain 13 cards of clubs" in { "contain 13 cards of clubs" in {
CardBaseManager.cardContainer.count(_.suit == Suit.Clubs) mustBe 13 KnockOutWhist.config.cardManager.cardContainer.count(_.suit == Suit.Clubs) mustBe 13
} }
"have cards in a different order after shuffling it" in { "have cards in a different order after shuffling it" in {
val originalDeck = List(CardBaseManager.cardContainer) val originalDeck = List(KnockOutWhist.config.cardManager)
CardBaseManager.shuffleAndReset() val cardManager = KnockOutWhist.config.cardManager
val shuffledDeck = CardBaseManager.cardContainer cardManager.shuffleAndReset()
val shuffledDeck = KnockOutWhist.config.cardManager
shuffledDeck should not equal originalDeck shuffledDeck should not equal originalDeck
} }
"provide cards" in { "provide cards" in {
val nextCard = CardBaseManager.nextCard() val cardManager = KnockOutWhist.config.cardManager
val nextCard = cardManager.nextCard()
nextCard should not be null nextCard should not be null
} }
"provide different cards" in { "provide different cards" in {
val nextCard = CardBaseManager.nextCard() val cardManager = KnockOutWhist.config.cardManager
val nextCard2 = CardBaseManager.nextCard() val nextCard = cardManager.nextCard()
val nextCard2 = cardManager.nextCard()
nextCard should not equal nextCard2 nextCard should not equal nextCard2
} }
"supply a hand of 7 cards for the first round" in { "supply a hand of 7 cards for the first round" in {
val hand = CardBaseManager.createHand() val cardManager = KnockOutWhist.config.cardManager
val hand = cardManager.createHand()
hand.cards should have size 7 hand.cards should have size 7
} }
"supply a hand of 2 cards" in { "supply a hand of 2 cards" in {
val hand = CardBaseManager.createHand(2) val cardManager = KnockOutWhist.config.cardManager
val hand = cardManager.createHand(2)
hand.cards should have size 2 hand.cards should have size 2
} }
"throw an exception if you request more then 52 cards without shuffling" in { "throw an exception if you request more then 52 cards without shuffling" in {
val cardManager = KnockOutWhist.config.cardManager
assertThrows[IndexOutOfBoundsException] { assertThrows[IndexOutOfBoundsException] {
for (_ <- 1 to 53) { for (_ <- 1 to 53) {
CardBaseManager.nextCard() cardManager.nextCard()
} }
} }
} }

View File

@@ -12,6 +12,8 @@ import org.scalatest.matchers.must.Matchers
import org.scalatest.matchers.should.Matchers.{should, shouldBe} import org.scalatest.matchers.should.Matchers.{should, shouldBe}
import org.scalatest.wordspec.AnyWordSpec import org.scalatest.wordspec.AnyWordSpec
import java.util.UUID
class DefaultConfigurationTests extends AnyWordSpec with Matchers{ class DefaultConfigurationTests extends AnyWordSpec with Matchers{
"The Configuration by default" should { "The Configuration by default" should {
"select MainLogic for the main component" in { "select MainLogic for the main component" in {
@@ -29,15 +31,12 @@ class DefaultConfigurationTests extends AnyWordSpec with Matchers{
"select TrickLogic for the trick component" in { "select TrickLogic for the trick component" in {
DefaultConfiguration.trickcomponent shouldBe TrickLogic DefaultConfiguration.trickcomponent shouldBe TrickLogic
} }
"select CardBaseManager for the cardManager" in {
DefaultConfiguration.cardManager shouldBe CardBaseManager
}
"select RoundLogic for the round logic component" in { "select RoundLogic for the round logic component" in {
DefaultConfiguration.roundlogcomponent shouldBe RoundLogic DefaultConfiguration.roundlogcomponent shouldBe RoundLogic
} }
"create a CustomPlayerBaseQueue as the right Queue" in { "create a CustomPlayerBaseQueue as the right Queue" in {
val player1 = PlayerFactory.createPlayer("Peter", HUMAN) val player1 = PlayerFactory.createPlayer("Peter", UUID.randomUUID(), HUMAN)
val queue = new CustomPlayerBaseQueue(Array(player1), 0) val queue = new CustomPlayerBaseQueue(Array(player1), 0)
val rightQueue = DefaultConfiguration.createRightQueue(Array(player1), 0) val rightQueue = DefaultConfiguration.createRightQueue(Array(player1), 0)
rightQueue.currentIndex shouldBe queue.currentIndex rightQueue.currentIndex shouldBe queue.currentIndex

View File

@@ -14,6 +14,8 @@ import org.scalatest.matchers.must.Matchers
import org.scalatest.matchers.should.Matchers.{should, shouldBe} import org.scalatest.matchers.should.Matchers.{should, shouldBe}
import org.scalatest.wordspec.AnyWordSpec import org.scalatest.wordspec.AnyWordSpec
import java.util.UUID
class MatchControllerTests extends AnyWordSpec with Matchers { class MatchControllerTests extends AnyWordSpec with Matchers {
"The enter players function" should { "The enter players function" should {
@@ -22,7 +24,7 @@ class MatchControllerTests extends AnyWordSpec with Matchers {
TestUtil.cancelOut() { TestUtil.cancelOut() {
TestUtil.simulateInput("foo,bar\n") { TestUtil.simulateInput("foo,bar\n") {
ControlThread.runLater { ControlThread.runLater {
MainLogic.startMatch() should not be(List(PlayerFactory.createPlayer("foo", HUMAN), PlayerFactory.createPlayer("bar", HUMAN))) MainLogic.startMatch() should not be(List(PlayerFactory.createPlayer("foo", UUID.randomUUID(), HUMAN), PlayerFactory.createPlayer("bar", UUID.randomUUID(), HUMAN)))
} }
} }
} }

View File

@@ -1,5 +1,6 @@
package de.knockoutwhist.logic package de.knockoutwhist.logic
import de.knockoutwhist.KnockOutWhist
import de.knockoutwhist.cards.{Card, CardValue, Hand, Suit} import de.knockoutwhist.cards.{Card, CardValue, Hand, Suit}
import de.knockoutwhist.control.ControlThread import de.knockoutwhist.control.ControlThread
import de.knockoutwhist.control.controllerBaseImpl.MainLogic import de.knockoutwhist.control.controllerBaseImpl.MainLogic
@@ -10,19 +11,21 @@ import de.knockoutwhist.testutils.TestUtil
import org.scalatest.matchers.must.Matchers import org.scalatest.matchers.must.Matchers
import org.scalatest.wordspec.AnyWordSpec import org.scalatest.wordspec.AnyWordSpec
import java.util.UUID
class CtrRoundTests extends AnyWordSpec with Matchers { class CtrRoundTests extends AnyWordSpec with Matchers {
"Control Round" should { "Control Round" should {
TestUtil.disableDelay() TestUtil.disableDelay()
"Work" in { "Work" in {
val player1 = PlayerFactory.createPlayer("Gunter", HUMAN) val player1 = PlayerFactory.createPlayer("Gunter", UUID.randomUUID(), HUMAN)
val player2 = PlayerFactory.createPlayer("Peter", HUMAN) val player2 = PlayerFactory.createPlayer("Peter", UUID.randomUUID(), HUMAN)
val hand1 = Hand(List(Card(CardValue.Two, Suit.Hearts), Card(CardValue.Three, Suit.Hearts))) val hand1 = Hand(List(Card(CardValue.Two, Suit.Hearts), Card(CardValue.Three, Suit.Hearts)))
val hand2 = Hand(List(Card(CardValue.Four, Suit.Hearts), Card(CardValue.Five, Suit.Hearts))) val hand2 = Hand(List(Card(CardValue.Four, Suit.Hearts), Card(CardValue.Five, Suit.Hearts)))
player1.provideHand(hand1) player1.provideHand(hand1)
player2.provideHand(hand2) player2.provideHand(hand2)
val round1 = Round(Suit.Spades, List(), List(player1, player2), List(), 0, player1, false) val round1 = Round(Suit.Spades, List(), List(player1, player2), List(), 0, player1, false)
val match1 = Match(List(player1, player2), 2, true, List(round1)) val match1 = Match(List(player1, player2), 2, true, List(round1), KnockOutWhist.config.cardManager)
ControlThread.runLater { ControlThread.runLater {
TestUtil.simulateInput("2\n") { TestUtil.simulateInput("2\n") {
MainLogic.controlRound(match1, round1) MainLogic.controlRound(match1, round1)

View File

@@ -1,5 +1,6 @@
package de.knockoutwhist.logic package de.knockoutwhist.logic
import de.knockoutwhist.KnockOutWhist
import de.knockoutwhist.cards.CardValue.{Ace, Seven, Six, Ten} import de.knockoutwhist.cards.CardValue.{Ace, Seven, Six, Ten}
import de.knockoutwhist.cards.Suit.{Clubs, Spades} import de.knockoutwhist.cards.Suit.{Clubs, Spades}
import de.knockoutwhist.cards.{Card, CardValue, Hand, Suit} import de.knockoutwhist.cards.{Card, CardValue, Hand, Suit}
@@ -14,6 +15,7 @@ import org.scalatest.matchers.must.Matchers
import org.scalatest.matchers.should.Matchers.shouldBe import org.scalatest.matchers.should.Matchers.shouldBe
import org.scalatest.wordspec.AnyWordSpec import org.scalatest.wordspec.AnyWordSpec
import java.util.UUID
import scala.collection.{immutable, mutable} import scala.collection.{immutable, mutable}
class MainLogicTests extends AnyWordSpec with Matchers { class MainLogicTests extends AnyWordSpec with Matchers {
@@ -22,7 +24,7 @@ class MainLogicTests extends AnyWordSpec with Matchers {
"check whether the card played was the first card played in the trick and return the correct trick" in { "check whether the card played was the first card played in the trick and return the correct trick" in {
val trick1 = Trick() val trick1 = Trick()
val card1 = Card(Ace, Spades) val card1 = Card(Ace, Spades)
val player1 = PlayerFactory.createPlayer("Gunter", HUMAN) val player1 = PlayerFactory.createPlayer("Gunter", UUID.randomUUID(), HUMAN)
ControlThread.runLater { ControlThread.runLater {
MainLogic.playCard(trick1, card1, player1) shouldBe Trick(firstCard = Some(card1), cards = immutable.HashMap(card1 -> player1)) MainLogic.playCard(trick1, card1, player1) shouldBe Trick(firstCard = Some(card1), cards = immutable.HashMap(card1 -> player1))
} }
@@ -31,7 +33,7 @@ class MainLogicTests extends AnyWordSpec with Matchers {
val firstcard = Card(Ten, Clubs) val firstcard = Card(Ten, Clubs)
val trick1 = Trick(firstCard = Some(firstcard)) val trick1 = Trick(firstCard = Some(firstcard))
val card1 = Card(Ace, Spades) val card1 = Card(Ace, Spades)
val player1 = PlayerFactory.createPlayer("Gunter", HUMAN) val player1 = PlayerFactory.createPlayer("Gunter", UUID.randomUUID(), HUMAN)
ControlThread.runLater { ControlThread.runLater {
MainLogic.playCard(trick1, card1, player1) shouldBe Trick(firstCard = Some(firstcard), cards = immutable.HashMap(card1 -> player1)) MainLogic.playCard(trick1, card1, player1) shouldBe Trick(firstCard = Some(firstcard), cards = immutable.HashMap(card1 -> player1))
} }
@@ -45,8 +47,8 @@ class MainLogicTests extends AnyWordSpec with Matchers {
} }
} }
"be able to insert the entered Players into the match data structure start with the trick by asking the player for a card" in { "be able to insert the entered Players into the match data structure start with the trick by asking the player for a card" in {
val player1 = PlayerFactory.createPlayer("Gunter", HUMAN) val player1 = PlayerFactory.createPlayer("Gunter", UUID.randomUUID(), HUMAN)
val player2 = PlayerFactory.createPlayer("Peter", HUMAN) val player2 = PlayerFactory.createPlayer("Peter", UUID.randomUUID(), HUMAN)
ControlThread.runLater { ControlThread.runLater {
MainLogic.enteredPlayers(List(player1, player2)) MainLogic.enteredPlayers(List(player1, player2))
} }
@@ -54,19 +56,19 @@ class MainLogicTests extends AnyWordSpec with Matchers {
} }
"controlMatch" should { "controlMatch" should {
"check if the current match is already finished and if so, show who won etc." in { "check if the current match is already finished and if so, show who won etc." in {
val player1 = PlayerFactory.createPlayer("Gunter", HUMAN) val player1 = PlayerFactory.createPlayer("Gunter", UUID.randomUUID(), HUMAN)
val player2 = PlayerFactory.createPlayer("Peter", HUMAN) val player2 = PlayerFactory.createPlayer("Peter", UUID.randomUUID(), HUMAN)
val round1 = Round(Suit.Spades, List(), List(player1), List(), 0, player1, false) val round1 = Round(Suit.Spades, List(), List(player1), List(), 0, player1, false)
val match1 = Match(List(player1, player2), 5, true, List(round1)) //a finished Match val match1 = Match(List(player1, player2), 5, true, List(round1), KnockOutWhist.config.cardManager) //a finished Match
ControlThread.runLater { ControlThread.runLater {
MainLogic.controlMatch(match1) MainLogic.controlMatch(match1)
} }
} }
"check if the current match is already finished and if not, get the remaining players and continue" in { "check if the current match is already finished and if not, get the remaining players and continue" in {
val player1 = PlayerFactory.createPlayer("Gunter", HUMAN) val player1 = PlayerFactory.createPlayer("Gunter", UUID.randomUUID(), HUMAN)
val player2 = PlayerFactory.createPlayer("Peter", HUMAN) val player2 = PlayerFactory.createPlayer("Peter", UUID.randomUUID(), HUMAN)
val round1 = Round(Suit.Spades, List(), List(player1, player2), List(), 0, player1, false) val round1 = Round(Suit.Spades, List(), List(player1, player2), List(), 0, player1, false)
val match1 = Match(List(player1, player2), 5, true, List(round1)) val match1 = Match(List(player1, player2), 5, true, List(round1), KnockOutWhist.config.cardManager)
ControlThread.runLater { ControlThread.runLater {
MainLogic.controlMatch(match1) MainLogic.controlMatch(match1)
} }

View File

@@ -1,5 +1,6 @@
package de.knockoutwhist.logic package de.knockoutwhist.logic
import de.knockoutwhist.KnockOutWhist
import de.knockoutwhist.cards.Suit import de.knockoutwhist.cards.Suit
import de.knockoutwhist.control.controllerBaseImpl.MatchLogic import de.knockoutwhist.control.controllerBaseImpl.MatchLogic
import de.knockoutwhist.player.PlayerFactory import de.knockoutwhist.player.PlayerFactory
@@ -9,20 +10,22 @@ import org.scalatest.matchers.must.Matchers
import org.scalatest.matchers.should.Matchers.shouldBe import org.scalatest.matchers.should.Matchers.shouldBe
import org.scalatest.wordspec.AnyWordSpec import org.scalatest.wordspec.AnyWordSpec
import java.util.UUID
class MatchLogicTests extends AnyWordSpec with Matchers { class MatchLogicTests extends AnyWordSpec with Matchers {
"The Match logic" should { "The Match logic" should {
"check the already finished rounds and return false when it is empty (because the Match can't be finished" in { "check the already finished rounds and return false when it is empty (because the Match can't be finished" in {
val player1 = PlayerFactory.createPlayer("Gunter", HUMAN) val player1 = PlayerFactory.createPlayer("Gunter", UUID.randomUUID(), HUMAN)
val player2 = PlayerFactory.createPlayer("Peter", HUMAN) val player2 = PlayerFactory.createPlayer("Peter", UUID.randomUUID(), HUMAN)
val match1 = Match(List(player1, player2), 5, true, List()) val match1 = Match(List(player1, player2), 5, true, List(), KnockOutWhist.config.cardManager)
MatchLogic.isOver(match1) shouldBe false MatchLogic.isOver(match1) shouldBe false
} }
"return true when calling isOver if the match is over" in { "return true when calling isOver if the match is over" in {
val player1 = PlayerFactory.createPlayer("Gunter", HUMAN) val player1 = PlayerFactory.createPlayer("Gunter", UUID.randomUUID(), HUMAN)
val player2 = PlayerFactory.createPlayer("Peter", HUMAN) val player2 = PlayerFactory.createPlayer("Peter", UUID.randomUUID(), HUMAN)
val round1 = new Round(Suit.Spades, List(player1), false) val round1 = new Round(Suit.Spades, List(player1), false)
val match1 = Match(List(player1, player2), 5, true, List(round1)) val match1 = Match(List(player1, player2), 5, true, List(round1), KnockOutWhist.config.cardManager)
MatchLogic.isOver(match1) shouldBe true MatchLogic.isOver(match1) shouldBe true
} }
} }

View File

@@ -1,5 +1,6 @@
package de.knockoutwhist.player package de.knockoutwhist.player
import de.knockoutwhist.KnockOutWhist
import de.knockoutwhist.cards.{Card, CardValue, Hand, Suit} import de.knockoutwhist.cards.{Card, CardValue, Hand, Suit}
import de.knockoutwhist.control.ControlThread import de.knockoutwhist.control.ControlThread
import de.knockoutwhist.control.controllerBaseImpl.TrickLogic import de.knockoutwhist.control.controllerBaseImpl.TrickLogic
@@ -9,6 +10,8 @@ import org.scalatest.wordspec.AnyWordSpec
import de.knockoutwhist.player.StubPlayer import de.knockoutwhist.player.StubPlayer
import de.knockoutwhist.rounds.{Match, Round, Trick} import de.knockoutwhist.rounds.{Match, Round, Trick}
import java.util.UUID
class StubPlayerTests extends AnyWordSpec with Matchers { class StubPlayerTests extends AnyWordSpec with Matchers {
"The StubPlayer" should { "The StubPlayer" should {
"be able to provide a hand" in { "be able to provide a hand" in {
@@ -26,14 +29,14 @@ class StubPlayerTests extends AnyWordSpec with Matchers {
"be able to set the doglife" in { "be able to set the doglife" in {
val hand1 = Hand(List(Card(CardValue.Two, Suit.Hearts), Card(CardValue.Three, Suit.Hearts))) val hand1 = Hand(List(Card(CardValue.Two, Suit.Hearts), Card(CardValue.Three, Suit.Hearts)))
val player1 = StubPlayer("Gunter", Some(hand1)) val player1 = StubPlayer("Gunter", Some(hand1))
player1.setDogLife() shouldBe StubPlayer("Gunter", Some(hand1), true) player1.setDogLife() shouldBe StubPlayer("Gunter", Some(hand1), UUID.randomUUID(), true)
} }
"be able to handle a Card played" in { "be able to handle a Card played" in {
val player1 = PlayerFactory.createPlayer("Gunter", HUMAN) val player1 = PlayerFactory.createPlayer("Gunter", UUID.randomUUID(), HUMAN)
val player2 = PlayerFactory.createPlayer("Peter", HUMAN) val player2 = PlayerFactory.createPlayer("Peter", UUID.randomUUID(), HUMAN)
val round1 = Round(Suit.Spades, List(), List(player1, player2), List(), 0, player1, false) val round1 = Round(Suit.Spades, List(), List(player1, player2), List(), 0, player1, false)
val trick1 = Trick() val trick1 = Trick()
val match1 = Match(List(player1, player2), 5, false, List(round1)) val match1 = Match(List(player1, player2), 5, false, List(round1), KnockOutWhist.config.cardManager)
val hand1 = Hand(List(Card(CardValue.Two, Suit.Hearts), Card(CardValue.Three, Suit.Hearts))) val hand1 = Hand(List(Card(CardValue.Two, Suit.Hearts), Card(CardValue.Three, Suit.Hearts)))
val hand2 = Hand(List(Card(CardValue.Four, Suit.Hearts), Card(CardValue.Five, Suit.Hearts))) val hand2 = Hand(List(Card(CardValue.Four, Suit.Hearts), Card(CardValue.Five, Suit.Hearts)))
player1.provideHand(hand1) player1.provideHand(hand1)

View File

@@ -1,5 +1,6 @@
package de.knockoutwhist.rounds package de.knockoutwhist.rounds
import de.knockoutwhist.KnockOutWhist
import de.knockoutwhist.cards.base.CardBaseManager import de.knockoutwhist.cards.base.CardBaseManager
import de.knockoutwhist.testutils.TestUtil import de.knockoutwhist.testutils.TestUtil
import de.knockoutwhist.ui.tui.TUIMain import de.knockoutwhist.ui.tui.TUIMain
@@ -16,9 +17,10 @@ class GameplayTests extends AnyWordSpec with Matchers {
"not throw an exception" in { "not throw an exception" in {
TestUtil.enableDebugMode() TestUtil.enableDebugMode()
DelayHandler.activateDelay = false DelayHandler.activateDelay = false
val cardManager = KnockOutWhist.config.cardManager
//TestUtil.disableDelay() //TestUtil.disableDelay()
CardBaseManager.shuffleAndReset() cardManager.shuffleAndReset()
CardBaseManager.resetOrder() cardManager.resetOrder()
//TestUtil.cancelOut() { //TestUtil.cancelOut() {
TestUtil.simulateInput("a\n5\n1\nLeon,Janis\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\ny\n1\n1\n1\n2\n") { TestUtil.simulateInput("a\n5\n1\nLeon,Janis\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\ny\n1\n1\n1\n2\n") {
TUIMain.initial TUIMain.initial