Test a deck of Cards
<p>Trying to learn how to test in Java and think I have been at it for to long now because it feels like the more I trial and error the less I understand. I can't figure out how to test the Deck by filling it up with mocked cards? I wanna be able to test that the first card in the deck actually is a two of hearts before the deck gets shuffled or maybe compare it a whole list of cards just made for the test, but right now it stands totally still. Anyone who got any tips for testing a Deck with cards in a good way?</p>

<p><br/>
<strong><em>Card.java</em></strong></p>

<pre><code>package model;

public class Card {

    public enum Value {
        Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Knight, Queen, King, Ace
    }

    public enum Suite {
        Hearts, Spades, Diamonds, Clubs
    }

    private Value value;
    private Suite suite;

    public Card(Value value, Suite suite) {
        if(value == null || suite == null){
            throw new IllegalArgumentException("Argument can't be null");
        }

        this.value = value;
        this.suite = suite;
    }

    public Object getValue() {
        return this.value;
    }

    public Object getSuite() {
        return this.suite;
    }

    public String toString(){
        return value + " of " + suite;
    }
}
</code></pre>

<p><br/>
<strong><em>Deck.java</em></strong></p>

<pre><code>package model;
import java.util.ArrayList;

public class Deck {

    private ArrayList&lt;Card&gt; cards = new ArrayList&lt;Card&gt;();  
    private CardFactory CF = new CardFactory();

    public Deck(){
        init();
    }

    public void init() {        
        for (int i=0; i&lt;13; i++){    
            for (int j=0; j&lt;4; j++){
                //card = cardFactory.createCard(Card.Value.values()[i], Card.Suite.values()[j]);
                this.cards.add(CF.createCard(Card.Value.values()[i], Card.Suite.values()[j]));          
            }
        }
    }

    public Card getCard() {     
        return cards.remove(0);
    }

    public int cardsLeft() {        
        return cards.size();        
    }   

    public Card getLastCard() {
        return cards.remove(cards.size()-1);
    }
}
</code></pre>

<p><br/>
<strong><em>CardFactory.java</em></strong></p>

<pre><code>package model;

public class CardFactory {

    public Card createCard(Card.Value value, Card.Suite suite){
        return new Card(value, suite);
    }

}
</code></pre>

<p><br/>
<strong><em>DeckTest.java</em></strong></p>

<pre><code>package model;

import static org.mockito.Mockito.verify;
import static org.mockito.MockitoAnnotations.initMocks;

import java.util.ArrayList;

import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;

public class DeckTest {

    @Mock private ArrayList&lt;Card&gt; cards;
    @Mock private Card card;
    @Mock private CardFactory CF;

    @InjectMocks private Deck sut;

    @Before
    public void setUp() throws Exception {
        initMocks(this);
    }   

    @Test   
    public void DeckContains52Cards() {                     
        sut.init();     
        verify(cards, Mockito.times(52)).add(Mockito.any());
    }

    @Test   
    public void getCardIsCalled() {     
        sut.getCard();
        verify(cards).remove(0);        
    }

    @Test   
    public void cardsLeftIsCalled() {       
        sut.cardsLeft();        
        verify(cards).size();       
    }

    @Test   
    public void getLastCardIsCalled() {     
        sut.getLastCard();
        verify(cards).size();       
    }   
}
</code></pre>