### Question:
JDK8DeckOfCardsAsList { public Map<Suit, List<Card>> getCardsBySuit() { return this.cardsBySuit; } JDK8DeckOfCardsAsList(); Deque<Card> shuffle(Random random); Set<Card> deal(Deque<Card> deque, int count); List<Set<Card>> shuffleAndDeal(Random random, int hands, int cardsPerHand); List<Set<Card>> dealHands(Deque<Card> shuffled, int hands, int cardsPerHand); List<Card> diamonds(); List<Card> hearts(); List<Card> spades(); List<Card> clubs(); Map<Suit, Long> countsBySuit(); Map<Rank, Long> countsByRank(); List<Card> getCards(); Map<Suit, List<Card>> getCardsBySuit();  }### Answer:
@Test public void cardsBySuit() { var jdk1CardsBySuit = this.jdk1Deck.getCardsBySuit(); var jdk2CardsBySuit = this.jdk2Deck.getCardsBySuit(); Assert.assertEquals(jdk1CardsBySuit.get(Suit.CLUBS), jdk2CardsBySuit.get(Suit.CLUBS)); }
@Test public void cardsBySuitIsImmutable() { var jdk2CardsBySuit = this.jdk2Deck.getCardsBySuit(); Verify.assertThrows( UnsupportedOperationException.class, () -> jdk2CardsBySuit.remove(Suit.CLUBS)); Verify.assertThrows( UnsupportedOperationException.class, jdk2CardsBySuit::clear); Verify.assertThrows( UnsupportedOperationException.class, () -> jdk2CardsBySuit.get(Suit.CLUBS).remove(0)); Verify.assertThrows( UnsupportedOperationException.class, () -> jdk2CardsBySuit.get(Suit.CLUBS).add(null)); Verify.assertThrows( UnsupportedOperationException.class, jdk2CardsBySuit.get(Suit.CLUBS)::clear); }