title: Junit test for model class
body: <p>This question is about best practice rather than any issues or problem. I have a service method below that I am trying to test. myDAO is DAO class that will be injected and has all database call code.</p>
  
  <pre><code>public List&lt;MyObject&gt; getMyObject(String inputParameter){
      List&lt;MyObject&gt; objectList = myDAO.getObjectList(inputParameter);
      return objectList 
  }
  </code></pre>
  
  <p>And my Junit test case using mockito is</p>
  
  <pre><code>@RunWith(MockitoJUnitRunner.class)
  public class MyClassTest{
      @InjectMocks
      MyClass myClass;
  
      @Mock
      MyDAO myDAO;
  
      private MyObject myObj;
      private List&lt;MyObject&gt; objList;
  
      @Before
      public void setUp() throws Exception {  
          myObj = new MyObject();
          myObj.setQuantity(10);
          //I am calling all setter method to prepare myObj here
          objList = new ArrayList&lt;MyObject&gt;();
          objList.add(myObj); 
  
          when(myDAO.getObjectList(any(InputParameter.class))
                                                      .thenReturn(objList);    
      }
  
  
      @Test
      public void testGetMyObject(){
  
          List&lt;MyObject&gt; result =  myClass.getMybject(null);
          assertThat(" Quantity should return 10", result.getQuantity(), is(10));
          // and all asserts....
      }
  </code></pre>
  
  <p>Everything is fine and working. My main problem here is MyObject is a modal class with 200 parameter. </p>
  
  <p>Now for code coverage I have to call 200 setter methods while preparing objects  and asserts 200 getter methods for junit test. I think this is not a good idea. what is better practice and how to cover this kind of modal class on unit test code coverage.</p>