title: How to test setter in JUnit?
body: <p>I am studying about JUnit test. I want to test getter and setter in JUnit, but it doesn't work.
  This is the first class.</p>
  <pre><code>public class Practice {
  private String name;
  
  public Practice(String name) {
      this.name = name;
  }
  
  public String getName() {
      return this.name;
  }
  
  public void setName(String name) {
      this.name = name;
  }
  </code></pre>
  <p>}
  and this is the second class.</p>
  <pre><code>import java.util.ArrayList;
  
  public class Practice2 {
  private ArrayList&lt;Practice&gt; practice;
  
  public Practice2() {
      this.practice = new ArrayList&lt;Practice&gt;();
  }
  
  public ArrayList&lt;Practice&gt; getPractice() {
      return this.practice;
  }
  
  public void setPractice(ArrayList&lt;Practice&gt; practice) {
      this.practice = practice;
  }
  }
  </code></pre>
  <p>The parameter of setPractice is ArrayList, so I put object of Practice class in the parameter, but It shows an error.</p>
  <pre><code>import org.junit.jupiter.api.Test;
  
  public class testGetterAndSetter {
  
  @Test
  public void testSetter() {
      Practice2 aaa = new Practice2();
      Practice bbb = new Practice(&quot;Hello&quot;);
      aaa.setPractice(bbb.setName(&quot;A&quot;));
  }
  }
  </code></pre>
  <p>How do I need to change for testing the setter, and how can I test for this?</p>