### Question:
JDKImperativeDeckOfCardsAsSortedSet { public SortedSet<Card> getCards() { return this.cards; } JDKImperativeDeckOfCardsAsSortedSet(); 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); SortedSet<Card> diamonds(); SortedSet<Card> hearts(); SortedSet<Card> spades(); SortedSet<Card> clubs(); Map<Suit, Long> countsBySuit(); Map<Rank, Long> countsByRank(); SortedSet<Card> getCards(); Map<Suit, SortedSet<Card>> getCardsBySuit();  }### Answer:
@Test public void allCards() { Assert.assertEquals(52, this.jdkDeck.getCards().size()); Assert.assertEquals(new Card(Rank.ACE, Suit.SPADES), this.jdkDeck.getCards().first()); Assert.assertEquals(new Card(Rank.KING, Suit.CLUBS), this.jdkDeck.getCards().last()); }
@Test public void cardsAreImmutable() { var jdkCards = this.jdkDeck.getCards(); Verify.assertThrows( UnsupportedOperationException.class, () -> jdkCards.remove(null)); Verify.assertThrows( UnsupportedOperationException.class, jdkCards::clear); Verify.assertThrows( UnsupportedOperationException.class, () -> jdkCards.add(null)); }