title: How to store the TestNG dataprovider values in a POJO class
body: <p>I have a excel sheet which has two column as look below:</p>
  
  <p><a href="https://i.stack.imgur.com/nDbuI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nDbuI.png" alt="enter image description here"></a></p>
  
  <p>I used @Dataprovider (TestNG annotation) to read a data from excel sheet and pass it @Test method. And test method shows like below</p>
  
  <pre><code>@Test(dataProvider = "testautomation")
      public void getData(String userName, String password)throws Exception 
        {
          System.out.println(userName+ "\t ****");
          System.out.println(password);
        }
  </code></pre>
  
  <p>It works as expected, and got a proper data from excel sheet. But Is there any way I can keep those two arguments in pojo class and pass the class object in @test method?. By the way I can stop exposing the arguments like (username, password in @Test method).</p>
  
  <p>May be the pojo class look like below:</p>
  
  <pre><code>public class DatObject
   {
      private String userName;
      private String password;
  
      //and getter setter methods.
   }
  </code></pre>
  
  <p>And the Test method will be like below:</p>
  
  <pre><code>@Test(dataProvider = "testautomation")
          public void getData(DataObject dataObj)throws Exception 
            {
  
              System.out.println(dataObj.getUserName()+ "\t ****");
              System.out.println(dataObj.getPasswrod());
            }
  </code></pre>
  
  <p>I want to call this pojo class object as argument in @test method, and using getter and setter methods in pojo class used to get values instead of passing username, and password in @Test method.</p>
  
  <p>Any leads?</p>