-1

Unable to return ArrayList values to test case

Error : Could not find matching constructor for: java.util.ArrayList(java.awt.Dimension)

My code:

Keyword:

public ArrayList<Integer> othersites() {

        String[] sits = new String[9];
        sits[0] = "https://www.tadawul.com.sa/wps/portal/tadawul/home/";
        sits[1] = "https://www.msm.gov.om/";

        WebUI.navigateToUrl(sits[0]);
        String tdwl = WebUI.getText(findTestObject('ObjectRepository/Sites/site_tdwl'),FailureHandling.CONTINUE_ON_FAILURE)
        String[] parts0 = tdwl.split("\\.")
        String part0 = parts0[0]; // 00
        String part00 = Integer.parseInt(part0.replaceAll(",", ""))
        .
        .

        List<String> list = new ArrayList<String>();
        list.add(part00);
        list.add(part11);

        List<Integer> newList1 = new ArrayList<Integer>(list.size()) ;
        for (String myInt1 : list)
        {
          newList1.add(Integer.valueOf(myInt1));
        }

        return newList1

    }
} 

Customkeyword :

CustomKeywords.'decypha_equities.otherSiteValuesCapture.othersites'()

Expected result :[8566, 3869, 6606, 9806, 2791, 14304, 1529, 1847, 5028]

Actual result : Could not find matching constructor for: java.util.ArrayList(java.awt.Dimension)

lahimadhe
  • 374
  • 2
  • 16
  • Can you attach the full stacktrace? It doesn’t look like the error is originating from the code you have posted. – tomtzook Sep 05 '19 at 06:09

1 Answers1

1

Your method return a List not an ArrayList, instead change :

public ArrayList<Integer> othersites() {

to :

import java.util.ArrayList;
import java.util.List;
...
public List<Integer> othersites() {
Youcef LAIDANI
  • 55,661
  • 15
  • 90
  • 140
  • Line error , its says :- ```Multiple markers at this line - The type List is not generic; it cannot be parameterized with arguments - Groovy:The class java.awt.List refers to the class java.awt.List and uses 1 parameters, but the referred class takes no parameters``` – lahimadhe Sep 05 '19 at 06:02
  • 1
    @lahimadhe it seems you are not using the correct import methods check my edit – Youcef LAIDANI Sep 05 '19 at 06:04