title: How do I use JUnit to test the getter and setter methods of an ArrayList?
body: <p>I need to write test cases for a Card game. I'm stuck on a getter and setter method for an arrayList. The arrayList holds the cards for a player's hand and takes an object of another class.</p>
  
  <pre><code>Card Class  // Describes the cards
  Card(int suit, int rank, boolean ID, int points):
  
  // The cards are fractions instead of traditional cards
  
  // Card(0, 0, true(isDouble), 0(extra point)) card looks like 0/0 
  
  Deck Class  // creates cards and hands
  static ArrayList&lt;Card&gt; playerFour = new ArrayList&lt;Card&gt;();
  
  public static ArrayList&lt;Card&gt; getPlayerFour() {
      return playerFour;
  }
  
  public static void setPlayerFour(ArrayList&lt;Card&gt; playerFour) {
      Deck.playerFour = playerFour;
  }
  
  @Test 
  void testGetPlayerFour() {
      // Can't figure out
  }
  
  @Test
  void testSetPlayerFour(){
      // Can't figure out
  }
  
  
  // Some of what I tried
  @Test
  void testGetPlayerFour() {
      Deck deck = new Deck();
      ArrayList&lt;Card&gt; playerFour = new ArrayList&lt;Card&gt;();
      playerFour.add(new Card(0, 0, false, 0));
      assertEquals(00, deck.getPlayerFour());
  }
  
  @Test
  void testSetPlayerFour() {
      Deck deck = new Deck();
      deck.setPlayerFour(new Card(0, 0, false, 0);
      assertEquals(00, deck.getPlayerFour());
  }
  </code></pre>
  
  <p>I'm not sure if I need <code>@Before</code> and <code>@After</code> to initiate the <code>ArrayList</code> in the test first. All of the reading and examples I can find use <code>ArrayList&lt;String or Integer&gt;</code>.</p>