title: Using hashmaps and testing in selenium webdriver in java
body: <p>I'm trying to get selenium webdriver to test this code but i get this error, is it because I'm running this as @Test using Test NG instead of public static main?:</p>
  
  <p>org.testng.TestNGException: </p>
  
  <p>Method PopulateBorrowerPresentAddress requires 1 parameters but 0 were supplied in the @Test annotation.</p>
  
  <pre><code>package testautomation;
  
  import static org.testng.AssertJUnit.assertTrue;
  import java.io.IOException;
  import java.util.HashMap;
  import java.util.Map;
  import java.util.concurrent.TimeUnit;
  
  import org.openqa.selenium.By;
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.WebDriverBackedSelenium;
  import org.openqa.selenium.WebElement;
  import org.openqa.selenium.chrome.ChromeDriver;
  import org.openqa.selenium.support.ui.ExpectedConditions;
  import org.openqa.selenium.support.ui.WebDriverWait;
  import org.testng.annotations.AfterClass;
  import org.testng.annotations.BeforeClass;
  import org.testng.annotations.BeforeMethod;
  import org.testng.annotations.Test;
  
  import com.thoughtworks.selenium.Selenium;
  
  public class BorrowerInformation  {
  
      static WebDriver driver;
  
      static Selenium selenium;
      //Base Element Names
      //Anything multiple parts of this class might use
      //or other stuff that other classes will use but belongs to this class
      static String FormBase = "viewModel.MortgageForm.";
      static String BorrowerInformationBase = FormBase + "BorrowerInformationSection.";
      static String PrimaryBorrowerBase = BorrowerInformationBase + "Borrowers[0]";
      static String PresentAddressElementName = ".PresentAddress";
  
      static String AddressElementName=".Address";
      static String BorrowerFirstNameElement = "_FirstName";
      static String BorrowerLastNameElement = "_LastName";
      static String BorrowerSuffixElement ="_Suffix";
      static String BorrowerSocialSecurityNumberElement= ".SocialSecurityNumber";
      static String BorrowerHomePhoneNumberElement= ".HomePhoneNumber";
      static String BorrowerYearsInSchoolElement= ".YearsInSchool";
      static String BorrowerMarriageStatusElement=".MarriageStatus";
  
      static String FormBase1 = "viewModel_MortgageForm_";
      static String BorrowerInformationBase1 = FormBase + "BorrowerInformationSection_";
      static String PrimaryBorrowerBase1 = BorrowerInformationBase1 + "Borrowers_1_";
  
      static String AddressLine1 = ".AddressLine1";
      static String AddressLine2 = ".AddressLine2";
      static String City = ".City";
      static String State = ".State";
      static String Zip= ".Zip";
      static String MailingAddressElementName = ".MailingAddress";
      static String MailingAddressSummaryElementName =  ".AddressSummary";
      static String FormerAddressElementName = ".FormerAddress";
  
      static String FormerAddressBase = PrimaryBorrowerBase+ FormerAddressElementName+AddressElementName;
      static String PresentAddressBase = PrimaryBorrowerBase+PresentAddressElementName+AddressElementName;
  
      static String MailingAddressBase = PrimaryBorrowerBase+ MailingAddressElementName;
  
  
      private static  Map&lt;String,String&gt; PrimaryBorrowerInputDictionary;
      static {
          Map&lt;String,String&gt; map = new HashMap&lt;String, String&gt;();
          map.put(BorrowerFirstNameElement,"Alex");
          map.put(BorrowerLastNameElement,"Holmes");
          map.put(BorrowerSuffixElement,"Mr.");
          map.put(BorrowerSocialSecurityNumberElement,"327-34-1869");
          map.put(BorrowerLastNameElement,"Holmes");
          map.put(BorrowerSocialSecurityNumberElement,"327-34-1869");
          map.put(BorrowerHomePhoneNumberElement,"773-223-23232");
          map.put(BorrowerYearsInSchoolElement,"5");
  
      }
      private static Map&lt;String,String&gt; PrimaryBorrowerPresentAddressDictionary;
      static {
          Map&lt;String,String&gt; map1 = new HashMap&lt;String, String&gt;();
          map1.put(AddressLine1,"2031 N. Harlem Ave");
          map1.put(AddressLine2,"2S");
          map1.put(City,"Chicago");
          map1.put(State,"IL");
          map1.put(Zip,"60707");
      }
  
      private static  Map&lt;String,String&gt; PrimaryBorrowerMailingAddressDictionary;
      static {
          Map&lt;String,String&gt; map2 = new HashMap&lt;String, String&gt;();
          map2.put(AddressLine1,"5840 W. Rice");
          map2.put(AddressLine2,"4S");
          map2.put(City,"Chicago");
          map2.put(State,"IL");
          map2.put(Zip,"60651");
      }
  
  private static  Map&lt;String,String&gt; PrimaryBorrowerFormerAddressDictionary;
  static {
      Map&lt;String,String&gt; map3 = new HashMap&lt;String, String&gt;();
      map3.put(AddressLine1,"351 S. Harvey St");
      map3.put(AddressLine2,"2A");
      map3.put(City,"Oak Park");
      map3.put(State,"IL");
      map3.put(Zip,"60707");
  }
  
      @Test
  public static void PopulateBorrower(String PrimaryBorrowerBaseName1,String
  PrimaryBorrowerBaseName)
      {       String fName= PrimaryBorrowerInputDictionary.get(BorrowerFirstNameElement);
              String lName=PrimaryBorrowerInputDictionary.get(BorrowerLastNameElement);
              String suffix=PrimaryBorrowerInputDictionary.get(BorrowerSuffixElement);
              String social=PrimaryBorrowerInputDictionary.get(BorrowerSocialSecurityNumberElement);
              String homePhone=PrimaryBorrowerInputDictionary.get(BorrowerHomePhoneNumberElement);
              String schoolYears=PrimaryBorrowerInputDictionary.get(BorrowerYearsInSchoolElement);
  
          driver.findElement(By.id(PrimaryBorrowerBaseName1 + BorrowerFirstNameElement)).sendKeys(fName);
          driver.findElement(By.id(PrimaryBorrowerBaseName1 + BorrowerLastNameElement)).sendKeys(lName);
          driver.findElement(By.id(PrimaryBorrowerBaseName1 + BorrowerSuffixElement)).sendKeys(suffix);
          driver.findElement(By.name(PrimaryBorrowerBaseName + BorrowerHomePhoneNumberElement)).sendKeys(social);
  
          driver.findElement(By.name(PrimaryBorrowerBaseName + BorrowerHomePhoneNumberElement)).sendKeys(homePhone);
          driver.findElement(By.name(PrimaryBorrowerBaseName + BorrowerYearsInSchoolElement)).sendKeys(schoolYears);
          driver.findElement(By.name(PrimaryBorrowerBaseName +BorrowerMarriageStatusElement )).click();
  
  
          assertEquals(               
                  driver.findElement(By.id(PrimaryBorrowerBaseName + BorrowerFirstNameElement))
                  .getText(), fName);
  
  
          assertEquals(               
                  driver.findElement(By.id(PrimaryBorrowerBaseName + BorrowerLastNameElement))
                  .getText(), lName);
  
  
          assertEquals(               
                  driver.findElement(By.id(PrimaryBorrowerBaseName + BorrowerSuffixElement))
                  .getText(), suffix);
  
  
          assertEquals(               
                  driver.findElement(By.id(PrimaryBorrowerBaseName + BorrowerHomePhoneNumberElement))
                  .getText(), homePhone);
  
          assertEquals(               
                  driver.findElement(By.id(PrimaryBorrowerBaseName + BorrowerYearsInSchoolElement))
                  .getText(), schoolYears);
  
          assertTrue(             
  
  
  
  
              driver.findElement(By.id(PrimaryBorrowerBaseName + BorrowerMarriageStatusElement))
                  .isSelected());
  
      }
  </code></pre>