Unit Testing LEVEL GAME
A student has pointed out that there’s a slight chance for our random tests to fail. RANDOMNESS probability our test will fail Where: i is the number of successes required to pass n is the total number of trials and p is the probability of occurrence For the example test, i=10 n=100 p=1/3 will fail with a probability of 5.28*10^-8 changing i to 1 probability is 1.25*10^-16
Solution has public variables – why? What are some pros/cons of approach? SOLUTION
Yes, clicked is the location of the player making the suggestion. (it can't be the card the player clicks on... BoardCell is not a card). This will be needed to move the accused player to that location. It is not really needed for the main logic of handleSuggestion. My calls to handleSuggestion look like: suggestion = new Solution("Miss Scarlet", "Dining Room", "Lead Pipe"); Assert.assertEquals(pipeCard, board.handleSuggestion(suggestion, mrsWhite, dummyCell)); OR assertNull(board.handleSuggestion(suggestion, mrGreen, dummyCell)); I create pipeCard in pipeCard = new Card("Lead Pipe", Card.CardType.WEAPON); My card class includes an equals method, so we don't have to worry about the card returned being the exact card in the player's hand... we just care that the name & type match. I "deal" cards by just assigning cards that I created to specific players, e.g.: mrsWhite.addCard(libraryCard); VALUE OF PIAZZA